Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp783211rwd; Thu, 15 Jun 2023 01:52:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mdYBzNqZemq3TzpdHEAb7M4Sg6b5ouCpaQe3xe03mp8EUjb2/Keb5SOT1FRlG/R0tTcDJ X-Received: by 2002:a17:907:5ce:b0:978:6e73:e837 with SMTP id wg14-20020a17090705ce00b009786e73e837mr19051644ejb.4.1686819167605; Thu, 15 Jun 2023 01:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686819167; cv=none; d=google.com; s=arc-20160816; b=YTeczO4Pufzt3n2uSjMPaliY/fM5UFZMG2sJgQBfmFg3TUDHwPmDOvGEICWRtO3PGs kFZl1Ibi8jx7iOMbSLqzt5qMblEPIFEQipa2rJevsRvM2bZuTpofkqXQHkXX3+ra1tXK FCATAWwtb9WtvCNmMRJjciAXbV11ZyajzjXt9pGYquiCs6jlii1r5T/A3XQv6VupcXcp C7vIOsHu2rOS7ZTn12R0nwEFYdw5doG5feU9yLyCWSiM/RYNhprPAdT9HOiJLL+PY5gB cw79s9wZHpoRt4/JaCBat3Mqm3q6OJOv3JMe8vQySLN5sedAhyCYpZLujcZjfPaiN/al yipA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8140F8ZxyIF8h0Y78lNADZ9yCgB7dr+4A7JOaUUAgcI=; b=WhH7X5/VoA2mCk2bmb/ss5Bq5KzbD8WdIliPC24CrYxEauNAT2A6UQuBpGcW8vE02e NVDfzkZRpZReQXjGFmwa681tMyW/AKs68l/UKjLuFCE95DrPpls5uOUXBy1jSuFJ2hv5 dxk5Kb2Ap4UPFqWp5I5pVZ/R0s3xvRpD+9jDuLOqa1YCbod2BktkaRudlIwSCRFGSGMf crEncIwo2AWZ5Nam7VtHiu+cDJkAU+TapYryJOyRpg6g23d7ssUOMObDU0f0lePaKR0y 8lmAdtrggpJ0qgwNlhpa2Gc5DPX8b7ipZ1TvABvLOtsduMkGJBaufqN1WeFbYlCOD5jm UnZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Z8nk6srO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gz15-20020a170906f2cf00b00982c0380cccsi35687ejb.917.2023.06.15.01.52.23; Thu, 15 Jun 2023 01:52:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Z8nk6srO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243907AbjFOIah (ORCPT + 99 others); Thu, 15 Jun 2023 04:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240677AbjFOIaf (ORCPT ); Thu, 15 Jun 2023 04:30:35 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 587631A3; Thu, 15 Jun 2023 01:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=8140F8ZxyIF8h0Y78lNADZ9yCgB7dr+4A7JOaUUAgcI=; b=Z8nk6srOke/jCJkziNLpMv2I9u hHlVHMipg7fqtKw/YA95q37ZJ9hb+MhkbXSdrIYQ+xbTBgyfbFZ8gOioQ68s0WXI3LHo8Xjrcr+Pm q5gyt066R88L/KOGdVYPWOA1PtL4/Lb+KhevAYmURmQosYXhA+mIbsM1uyV+4GxCcSHhXf/v8AhD1 FYa0vpuQOE4KNZffr0Rp8N465wJ+nVkAOVFYYNd8sam5MQkAQ2awILHwCIywcfzpqaxjYQNA6TD06 ekv386ndhr/dKt59ZiN565unKidOoXogHO2oL80v/afKfDz7eZe3iINNF/mFbbXO1yZYyeEUzV/pX +HhcwzCQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q9iMc-00BkWh-0K; Thu, 15 Jun 2023 08:29:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5D116300208; Thu, 15 Jun 2023 10:29:49 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3679B2456F421; Thu, 15 Jun 2023 10:29:49 +0200 (CEST) Date: Thu, 15 Jun 2023 10:29:49 +0200 From: Peter Zijlstra To: Dan Williams Cc: "Wilczynski, Michal" , alison.schofield@intel.com, "Rafael J. Wysocki" , Len Brown , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Andrew Morton , Jonathan Cameron , Dave Jiang , Mike Rapoport , x86@kernel.org, linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Derick Marks Subject: Re: [PATCH v2 1/2] x86/numa: Introduce numa_fill_memblks() Message-ID: <20230615082949.GA1683497@hirez.programming.kicks-ass.net> References: <9fcc548a6b4727cb2538e5227d7bad2e94e6adaf.1686712819.git.alison.schofield@intel.com> <03945e1f-caf6-3e5c-babc-d30e4e02b65e@intel.com> <6489b23bc67e0_142af829456@dwillia2-xfh.jf.intel.com.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6489b23bc67e0_142af829456@dwillia2-xfh.jf.intel.com.notmuch> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Wed, Jun 14, 2023 at 05:27:39AM -0700, Dan Williams wrote: > Wilczynski, Michal wrote: > > On 6/14/2023 6:35 AM, alison.schofield@intel.com wrote: > > > +static int __init cmp_memblk(const void *a, const void *b) > > > +{ > > > + const struct numa_memblk *ma = *(const struct numa_memblk **)a; > > > + const struct numa_memblk *mb = *(const struct numa_memblk **)b; > > > > Is this casting necessary? ? > > This is idiomatic for sort() comparison handlers. Aside of that, it *is* actually required, since sort() does indirect calls to it's cmp_func_t argument the Control Flow Integrity (CFI, not to be confused with Call-Frame-Information) stuff has a hard requirement that function signatures match. At the very least clang builds should warn if you do indirect calls with non-matching signatures these days. And kCFI enabled builds will get you a runtime error if you manage to ignore that warning. > > > + > > > + if (ma->start != mb->start) > > > + return (ma->start < mb->start) ? -1 : 1; > > > + > > > + /* Caller handles duplicate start addresses */ > > > + return 0; > > > +}