Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp397598rdb; Thu, 15 Feb 2024 03:48:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkpAEGA7M6arOxhlEhA/kLezjcng/d0K0LnWLJVhQPdPeKw+A7hx/VqjK/nYfwcVAnfo9isn7B8BhzXTxuLU2YrOm/eD/qph2YixbXtw== X-Google-Smtp-Source: AGHT+IE+slmv3myQ1ciR+YUc2C7aiEEwuz1UjW97SDuRgTDpT0mmoTFWoySL2+JFPV0yD3DAz5s6 X-Received: by 2002:a05:6830:1389:b0:6e2:decb:246a with SMTP id d9-20020a056830138900b006e2decb246amr1396233otq.3.1707997700282; Thu, 15 Feb 2024 03:48:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707997700; cv=pass; d=google.com; s=arc-20160816; b=PbgaBVIgatmjjJugvvg1qkseq5qD0NAO7CEczY6yFWWNRlp6kUdhmqESeLVS+Y9ZHP 6K7to2hJoduqwLPe4GAYMaY02gU6sZYLNiOwCYL5vZRZhqRbS1vhvkoCYZhDZJeFCMqM +1e51H3eYrRRcz/Yc6tj2PjgjHBNXr+IsZ6q781KPRJ10xlOoBoWqc+r31udcEuEutmy MUkCuPNlTg2G8vKzS8aeUCNu0VBnyuMCZl/Bfbsn/djXgd71CQmYHempr+Sr5ZzCThwv I3W58WljnLWq6QWagseGvPu0lpgXD9WEQNoKs5saTWhtZpwjk2KWq4HGpUxpT5UusRoW rFbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=0UjtjbO3Xzdv/ZSbvIuuzEh/GxtHBjezQtl9xSvIEJo=; fh=xjOhO0L+xA+QHG2cJ1GrSKgOEdqrMwaLCk9/qv7MQVw=; b=Ut01vCwAqrACOgAWjx1DaxmfSEh4ZNIABWxUg4Nl9JjUgMT67H7UCSmCf/1fIYrmv1 +YLOzJ4tPDKrPru7a6EloH+NpkRVMhG4lwG9Miecb87GjaLIUMeUzH8jdbC4pL8E1I9z BjTRSQacIt/wIFP5ttWd4MR7cYD0RfRlmTCXIoy8nTIqMBDI+KWq9w+jeb/mqFODptee /wan6+epSNZYvrKm9hFuJeZlQSeztlOVTV2GVCaR3JE9oZ4Kp3B4GgPBRCueVBrKTyth n0yt2LA5HSXnL3UrhZdyJ1zyG3uH9xmKeC/tYo/UJ4jei9fkYrZ7U11/sZSNfHpVjdPC DfcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-66818-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b124-20020a633482000000b005dc8914839bsi1005252pga.5.2024.02.15.03.48.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 03:48:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66818-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-66818-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F221C295F92 for ; Thu, 15 Feb 2024 11:39:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D03D612EBD8; Thu, 15 Feb 2024 11:36:48 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A93DE1EF1D; Thu, 15 Feb 2024 11:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707997008; cv=none; b=X6hXGz3Ttaz4RI1jOLlJLX+OjvkUYnwMevemO/w3BnFCiux61i343Yx8TA0OzaNWSQKNRZCzdoHDqOzCSEYpkzAea4zY87Kjxw8ioCQhAw6DT3l2ryTjDV608juWj+guiTGQavpugCD4i83TocZi0EcCg2LgwP/yMN4cz3AY7dw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707997008; c=relaxed/simple; bh=XIkDs6gXOoQBSmrBWGt6tw2dOXe9NdTa7wBQ3lRFzNQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KUk7z5l2eP59QpqG59oEErC+6NdB1o8qAFta1DLnqIdm2h1PJCJ6v9LJlHT/hCHZXPKo94vnXJjsjHYMjmgQxEvuK/7yB9FdP3+37ZAZ4/7yPZ9newpTvWfniBFXoWZ/At+CDXnlR2W7eDKgYjlyHI5yaGprTXG+o/exE2AQMpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11BD3DA7; Thu, 15 Feb 2024 03:37:27 -0800 (PST) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C91AC3F7B4; Thu, 15 Feb 2024 03:36:36 -0800 (PST) Message-ID: Date: Thu, 15 Feb 2024 11:36:35 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v3 2/7] dma: avoid redundant calls for sync operations Content-Language: en-GB To: Christoph Hellwig Cc: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marek Szyprowski , Joerg Roedel , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , Magnus Karlsson , Maciej Fijalkowski , Alexander Duyck , bpf@vger.kernel.org, netdev@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <20240214162201.4168778-1-aleksander.lobakin@intel.com> <20240214162201.4168778-3-aleksander.lobakin@intel.com> <3a9dd580-1977-418f-a3f3-73003dd37710@arm.com> <20240215050857.GC4861@lst.de> From: Robin Murphy In-Reply-To: <20240215050857.GC4861@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 15/02/2024 5:08 am, Christoph Hellwig wrote: > On Wed, Feb 14, 2024 at 05:55:23PM +0000, Robin Murphy wrote: >>> #define DMA_F_PCI_P2PDMA_SUPPORTED (1 << 0) >>> +#define DMA_F_CAN_SKIP_SYNC BIT(1) >> >> Yuck, please be consistent - either match the style of the existing code, >> or change that to BIT(0) as well. > > Just don't use BIT() ever. It doesn't save any typing and creates a > totally pointless mental indirection. > >> I guess this was the existing condition from dma_need_sync(), but now it's >> on a one-off slow path it might be nice to check the sync_sg_* ops as well >> for completeness, or at least comment that nobody should be implementing >> those without also implementing the sync_single_* ops. > > Implementing only one and not the other doesn't make any sense. Maybe > a debug check for that is ok, but thing will break badly if they aren't > in sync anyway. In principle we *could* have an implementation which used bouncing purely to merge coherent scatterlist segments, thus didn't need to do anything for single mappings. I agree that it wouldn't seem like a particularly realistic thing to do these days, but I don't believe the API rules it out, so it might be nice to enforce that assumption somewhere if we are actually relying on it (although I also concur that this may not necessarily be the ideal place to do that in general). Thanks, Robin.