Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp270027lqt; Mon, 18 Mar 2024 07:29:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4gehS/XM3kcPYKs6j6u0wlsp/JkKA6noCHMlHazG+AINl3TWfGwqDMXUGDX4dwCxBSr1icJCmxnirYGLwF0WQJlgd3sfAXZsEYsyGZQ== X-Google-Smtp-Source: AGHT+IGKe2yZpqw674uLfpGKO7wkI45vWXt8bX/4z26c8ZgbNKlC+w2tJMRUjwr/J1q10tWK0jqk X-Received: by 2002:ad4:5894:0:b0:691:825f:cbde with SMTP id dz20-20020ad45894000000b00691825fcbdemr9051884qvb.22.1710772178647; Mon, 18 Mar 2024 07:29:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710772178; cv=pass; d=google.com; s=arc-20160816; b=IYuND1LQC4xgyyXJCm7UsJhd2rpipwoTGdY+vuqmtoKkFuFmOzMli/yahF1rPwpHVt W+cGMaphqCJvE7dSXhglR95U5Fg/bibhMAjRkq0y6LbnOR8CIQOH8xijDQweupcMSsk2 fA2sy9EMsnO8NMK3IBVRMRXAD1XCfFBO2sCq6YxTV+rT9jZaWSjeZ7PhOLjnTpwQuLmn J51w/WhUQaiuxuFsjo8qP3M3/K2AHGQf+KyXZk1Wln0GB6Lso6i6M0ghYf30ueBcPPT7 qwTMqY+3k0jgP13BpdUIdygHDBvgxX69RECnno9Jp3Q3tOn7vP6OGqfZwE9z8Qx3/iXH 2iNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=rNeURgUeLHKgkgqNjWTLUo47aoGHXA5oW18R3OzXFro=; fh=Fef2ioWWBXemFSm7Wf7g4GoMn4Nxy+0jie7lEBYEREc=; b=q8MbybNT9idHInFKRlQvYbQN0YgAHu5kVZtLvF2jd7PzjRueIycGN1vDlybRtdS/7E 1ooks0jJ60Sg/I2pd31G34iZnts7XF/OMGRIO+xUGUMjRrfT/RhFvOM+qRpwOsm13uHL jZze09ml5nV6bo0RWOIQsZTFaX9rLGCx2dcSurozwK1rXp6/X8EAGOol4deqZiw7q9+X rbm55RRLRl5bAIZnK8MN7pCkmdojoZsmk0e2MTSxTuyBG9LuaGYn7BOoQYnjgKVTWCG+ M3WX3YHq5fFogkAMQHda65CmSXYPc1ENHUQyWi8JFq5XC0krBhxgw7sTyJzuL/f2h2PF oSNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-106222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c14-20020ad45aee000000b00690d10b5f1fsi8452206qvh.495.2024.03.18.07.29.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 07:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-106222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=huawei.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 58ACA1C21267 for ; Mon, 18 Mar 2024 14:29:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 053F04CE00; Mon, 18 Mar 2024 14:29:32 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 A432F25740; Mon, 18 Mar 2024 14:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710772171; cv=none; b=KhRKeAMO8iDSSxaeUHggp5OepRrOdv7OaHzHiqokXy/s9rtbyFKpEr960nY4YxvH091mxgmqhfwKVz9SXvFiknjxZvNZ9yprrq6nu2Ew11mpuNqry60sAa4YKYUhihWAbVyrjuBGdr4WGZo1uPamp8LETW8lKIvCwjbfJshb0dw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710772171; c=relaxed/simple; bh=+GIqwxv5fTwkaqVfplcuJmTziIweZkhHUrQQkNTEUJY=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=r6cMW9uocObeglBQfJ0JRy8XSLPZD7zxNQYwvD9uJNe37c2AebiLm/8IjXf3OQlm06F25ADobanG+6tq7ft6oKBDrOLEtn62SbpwdbnJqjXAVJyT2ePvQyziL2DKlkTOYefRZsacktC0yqv0608lmVzEt3UPsukzwVfd+lcEuo0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Tyxvp1kf0z6K9Y5; Mon, 18 Mar 2024 22:25:10 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 25C971408FF; Mon, 18 Mar 2024 22:29:25 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 18 Mar 2024 14:29:24 +0000 Date: Mon, 18 Mar 2024 14:29:23 +0000 From: Jonathan Cameron To: Andy Shevchenko CC: David Lechner , Jonathan Cameron , Michael Hennerich , Nuno =?ISO-8859-1?Q?S=E1?= , , Subject: Re: [PATCH v2] iio: adc: ad7944: Add support for "3-wire mode" Message-ID: <20240318142923.000042f4@Huawei.com> In-Reply-To: References: <20240314-mainline-ad7944-3-wire-mode-v2-1-d469da0705d2@baylibre.com> <20240318124041.0000032d@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) 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="UTF-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml500005.china.huawei.com (7.191.163.240) To lhrpeml500005.china.huawei.com (7.191.163.240) On Mon, 18 Mar 2024 15:09:32 +0200 Andy Shevchenko wrote: > On Mon, Mar 18, 2024 at 2:41=E2=80=AFPM Jonathan Cameron > wrote: > > > > struct ad7944_adc { > > > > struct spi_device *spi; > > > > + enum ad7944_spi_mode spi_mode; > > > > /* Chip-specific timing specifications. */ > > > > const struct ad7944_timing_spec *timing_spec; > > > > /* GPIO connected to CNV pin. */ > > > > @@ -58,6 +75,9 @@ struct ad7944_adc { > > > > } sample __aligned(IIO_DMA_MINALIGN); > > > > }; =20 > > > > > > Have you run `pahole` to see if there is a better place for a new mem= ber? =20 > > > > I know this matters for structures where we see lots of them, but do we= actually > > care for one offs? Whilst it doesn't matter here I'd focus much more > > on readability and like parameter grouping for cases like this than was= ting > > a few bytes. =20 >=20 > This is _also_ true, but think more about cache line contamination. > Even not-so-important bytes may decrease the performance. In some > cases it's tolerable, in some it is not (high-speed ADC). In general I > assume that the developer has to understand many aspects of the > software and cache line contamination may be last but definitely not > least. >=20 Not totally sure what you are covering with contamination as many aspects around caches and that's not really a standard term for any of them (as far as I know). It's part of a multi cacheline allocation anyway (because it's tacked on the end of the iio device struct, so fairly unlikely to share with other alloca= tions and definitely not on ARM because of the trailing __aligned(IIO_DMA_MINALIG= N) elements. If it matters more locally, then pahole is more likely to push you to pack things together in a fashion that makes false sharing and similar perf issu= es more likely if you are grouping things for packing purposes rather than logical groups. If you just mean cache pressure then fair enough if we squeeze everything i= nto one cacheline and that doesn't cause false sharing. 'Maybe' this will fit on x86. On Arm64 it's not going to make any difference, just moving the padding around a bit within the line. So I'd argue premature optimization for a small, one off, structure. Jonathan