From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E65B5C678DD for ; Thu, 17 Aug 2023 23:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mJ083TXUiB3XlmuNE8EG2s//Vc+RJQy24qto6E8CZ5Y=; b=fsbD+QakQdk8vr aoQBplHWvLTo6a4ZnHEGgOBUlIqipALvN9WbT4OCa38pwfKEQSo11UbBdFOBm1UXUnXwP3vJrOcin nx9pc3mQqECkRgVLuFlkWkPMwKQIzLGXJhXtYSMz8q+YXfCH2dVYRx50yKY9nQ+LbCr8jRDi5SdLc m2iOjwKEfH+ojZLMz00VveVvv9Fu9iM7wjXnmmIwws1l8qZ3puwwB5VMEVYbE+KDHDCb4Ckm6e2Kh gHyI4t5RvIuDvJMmMf+GXq64H2vnG63YB9MXBJvOFafsaTyErcTofOg+TRGtGDnyjjmGJFylelLDg LzUs5LZME393BYBpCpQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWmJq-007Jbs-2B; Thu, 17 Aug 2023 23:22:22 +0000 Received: from mgamail.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWmJn-007JbD-36 for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2023 23:22:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692314539; x=1723850539; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=jjim20PHoNcuWFjwQTxJ802NzhAvwG3kqWFOP4bvdkg=; b=gdR5Hn21w200sTnLrFqIgllXkrFIIqe5UXWM95aqsP/+wxdj+g9R48rJ gLU+AoArNCCoc0D+el0yGhc/1B7p+PrlfZ4ehcIr+PL63MtfzH0NgOoks WYAbUODrnOS7V1A8cOCMX3QJHdOobbVsHoRK3fJ+1+xbf9KFQGiRsJZku QGachKdeyFeHsvktW01UocRZvhjnyD37JnABaPlgQ1oIiThYt9PfnOLCL e2pPbVnagnUsLp2LLyXfj4IExJCuBRrMOjJb7dco5pBERg4exgFYCZgKe x/Tz8KM6d+pCfDU7QSFfVOb6dU4df92oSwZWIWGwS3sERrKN6r2c0UgNZ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10805"; a="376718397" X-IronPort-AV: E=Sophos;i="6.01,181,1684825200"; d="scan'208";a="376718397" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2023 16:22:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10805"; a="728358086" X-IronPort-AV: E=Sophos;i="6.01,181,1684825200"; d="scan'208";a="728358086" Received: from lacoffin-mobl.amr.corp.intel.com (HELO [10.212.196.192]) ([10.212.196.192]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2023 16:22:16 -0700 Message-ID: <3b1ca61c-fa3f-a802-6705-a8c1f37ad58f@intel.com> Date: Thu, 17 Aug 2023 16:22:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 03/15] mshyperv: Introduce numa_node_to_proximity_domain_info Content-Language: en-US To: Nuno Das Neves , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Cc: patches@lists.linux.dev, mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com References: <1692309711-5573-1-git-send-email-nunodasneves@linux.microsoft.com> <1692309711-5573-4-git-send-email-nunodasneves@linux.microsoft.com> From: Dave Hansen In-Reply-To: <1692309711-5573-4-git-send-email-nunodasneves@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_162220_059295_98BFBC5E X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/17/23 15:01, Nuno Das Neves wrote: > +static inline union hv_proximity_domain_info > +numa_node_to_proximity_domain_info(int node) > +{ > + union hv_proximity_domain_info proximity_domain_info; > + > + if (node != NUMA_NO_NODE) { > + proximity_domain_info.domain_id = node_to_pxm(node); > + proximity_domain_info.flags.reserved = 0; > + proximity_domain_info.flags.proximity_info_valid = 1; > + proximity_domain_info.flags.proximity_preferred = 1; > + } else { > + proximity_domain_info.as_uint64 = 0; > + } > + > + return proximity_domain_info; > +} Pop quiz: What are the rules for the 30 bits of uninitialized data of proximity_domain_info.flags in the (node != NUMA_NO_NODE) case? I actually don't know off the top of my head. I generally avoid bitfields, but if they were normal stack-allocated variable space, they'd be garbage. I'd also *much* rather see the "as_uint64 = 0" coded up as a memset() or even explicitly zeroing all the same variables as the other half of the if(). As it stands, it's not 100% obvious that proximity_domain_info is 64 bits and that .as_uint64=0 zeroes the whole thing. It *WOULD* be totally obvious if it were a memset(). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel