Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1034624rdb; Mon, 19 Feb 2024 01:57:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW5O814AZ4dqMIZ40VmrGHCWb9nmHBNPxdiGjANp4z7RzKj5+xGfR8a0jKP3fkCUmsOc1Kg6s3ZRL9loXvAIq6ofvNf/JYeJgBnUAKUFw== X-Google-Smtp-Source: AGHT+IH6ynbPz7hDj0V0Wj918xHd9GKd2QLaS7fNH8rhJfBRe7uxm5eNeNLu1Gxb+9I0lcu+7ydk X-Received: by 2002:a17:906:2b5a:b0:a3e:90eb:10e9 with SMTP id b26-20020a1709062b5a00b00a3e90eb10e9mr1510232ejg.19.1708336627791; Mon, 19 Feb 2024 01:57:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708336627; cv=pass; d=google.com; s=arc-20160816; b=KFQzXfPargCjMXyharZkKb48m8wrYHLnZV7JlfZ41/2qSZ7I9dyPBBRzK2IFTqWwE3 xTiqzj/qLFqppdhxxeV8bAQ7Kpi6VRnLrD7y/ZE9J0XGRqsxNqKSWv8KTauF+Ibzhijh Pa0dMv3sNubqPHAKQ0h9A5R8ta5sJqNaHwcyaK+VMJab6/bEiIIszUAiEKrCQaWUJLuq 845YP1Y/9v2wazWUnCbA8FUzEyhzd/VPEAPKRuxh/Dln65YtEPFA5tmA3Aweum044Fvf sHmET3F1moS8htWdWPzGJ5FzmE4YiygF27dShKH/EtSqTBAv56bW/86VHjnU5oINMuuz /akQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=n6dtuMzHo5sCbMhgQQrehzKfRLz5tbi3zkNihJNdxOo=; fh=IZHBYce64hH1mak/H4h3Z5r7a3slSuZk7Q8Sj2d6J2U=; b=yIw1QTT4X/cWSUtriwyw+M2OHEKip6keCxlq1fJAiOnHpGA+xVL/OOqIQlLmeYxaKd Yrz6dDZ32kuYd73iNg/Qx1MP8/KiuX/k7SqWBjaPfhVCH6MRR6oooq3XiYoqraEnHdq+ 4QyOGySJKuEuRN5QQaYQECViUzmsZVzA70WadrbWSPsmSR5rHwfOCrLCbAQDr9mEjVO6 bV05NR6JjTgyD2k+wdUiMvewm2TXBfSGXvgHa6urnilAQK2OjDiv95S3IdihgRrXK65B gsvFETkvwblhNkdYJDS7XDTJKYHXf4CNpNpdTWkahNOpa3RhXwsmQcgbw7hm83meZt8r c7Mg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=aiE42Muy; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71075-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71075-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id rn20-20020a170906d93400b00a3eb2a3c3d7si406666ejb.491.2024.02.19.01.57.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 01:57:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71075-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=aiE42Muy; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71075-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71075-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 640FB1F224DA for ; Mon, 19 Feb 2024 09:57:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 507A425114; Mon, 19 Feb 2024 09:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aiE42Muy" Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 285362376D for ; Mon, 19 Feb 2024 09:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708336619; cv=none; b=OOgKgCuaXDfv/DfytAbPtJYY8sDyVa16brYDJh4noCbkp13gzPybgvKisl+e7Do9hcyspZ8XHfN37Bwo9gJ6LPGW1CYrptsOH5B5smXUedeXG5CA4BsZNxUSFx7GgCyKxMEIwBoIX5ICDmtbqU8m2gNg3VCrDEgohOKEqc+nk0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708336619; c=relaxed/simple; bh=gsJCr79FUEiPZ2xM83pQIsVbvq1wE+I40Oaflbi2Ovw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CqKdwQnX2DAa/rZWUZgaa8v4y2SBDDM19x0GC52FE323pFyWyfhcjzJ8+vmGBq6yPOOLBbbZo+WP750ggaghcAJA9uU8OvmQnb4aBrYOVMIpDgSEqxDqW89yGGufFaUDKrUtTZxBITVz3guYonP/Xujoyx9nXg5z9ibSG32KlXA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aiE42Muy; arc=none smtp.client-ip=91.218.175.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Mon, 19 Feb 2024 04:56:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708336615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=n6dtuMzHo5sCbMhgQQrehzKfRLz5tbi3zkNihJNdxOo=; b=aiE42MuyHeXKvpH1+cI0et98lA6bnJ3ydTxxQW3QAItUsW1klN9DqHnX8zWdz7yY4zgFNs Pk/Q3XxdA5UsD6+HGWfMuFq8St0wj/RPPhHab9OM5CQX9/rReVB8Ne0/W1+Slgdunj2rny iQg+4kek5ypSoVuKqor5LQK4i6PxKP0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: "Russell King (Oracle)" Cc: Arnd Bergmann , Calvin Owens , Dave Martin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "linux-bcachefs@vger.kernel.org" Subject: Re: [PATCH] arm: Silence gcc warnings about arch ABI drift Message-ID: References: <431dd956-ad31-4da8-ad42-34f7380824bb@app.fastmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Mon, Feb 19, 2024 at 09:52:08AM +0000, Russell King (Oracle) wrote: > On Mon, Feb 19, 2024 at 04:40:00AM -0500, Kent Overstreet wrote: > > On Mon, Feb 19, 2024 at 09:26:51AM +0000, Russell King (Oracle) wrote: > > > On Mon, Feb 19, 2024 at 07:21:11AM +0100, Arnd Bergmann wrote: > > > > I think these should be addressed in bcachefs instead. > > > > While it's not the fault of bcachefs that the calling > > > > convention changed between gcc versions, have a look at > > > > the actual structure layout: > > > > > > > > struct bch_val { > > > > __u64 __nothing[0]; > > > > }; > > > > struct bpos { > > > > /* > > > > * Word order matches machine byte order - btree code treats a bpos as a > > > > * single large integer, for search/comparison purposes > > > > * > > > > * Note that wherever a bpos is embedded in another on disk data > > > > * structure, it has to be byte swabbed when reading in metadata that > > > > * wasn't written in native endian order: > > > > */ > > > > #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ > > > > __u32 snapshot; > > > > __u64 offset; > > > > __u64 inode; > > > > #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ > > > > __u64 inode; > > > > __u64 offset; /* Points to end of extent - sectors */ > > > > __u32 snapshot; > > > > #else > > > > #error edit for your odd byteorder. > > > > #endif > > > > } __packed > > > > struct bch_backpointer { > > > > struct bch_val v; > > > > __u8 btree_id; > > > > __u8 level; > > > > __u8 data_type; > > > > __u64 bucket_offset:40; > > > > __u32 bucket_len; > > > > struct bpos pos; > > > > } __packed __aligned(8); > > > > > > > > This is not something that should ever be passed by value > > > > into a function. > > > > > > +1 - bcachefs definitely needs fixing. Passing all that as an argument > > > not only means that it has to be read into registers, but also when > > > accessing members, it has to be extracted from those registers as well. > > > > > > Passing that by argument is utterly insane. > > > > If the compiler people can't figure out a vaguely efficient way to pass > > a small struct by value, that's their problem - from the way you > > describe it, I have to wonder at what insanity is going on there. > > It sounds like you have a personal cruisade here. > > Passing structures on through function arguments is never efficient. > The entire thing _has_ to be loaded from memory at function call and > either placed onto the stack (creating an effective memcpy() on every > function call) or into registers. Fundamentally. It's not something > compiler people can mess around with. > > Sorry but it's bcachefs that's the problem here, and well done to the > compiler people for pointing out stupid code. Eh? Passing via stack copy is normal and expected; you were talking about something else. I'm not always trying to write code that will generate the fastest assembly possible; there aro other considerations. As long a the compiler is doing something /reasonable/, the code is fine.