Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp252106rdb; Wed, 14 Feb 2024 21:21:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWj6aR3GlzjZfebg8O8E+EN03po5g1uaX1uKQVIXqOhicdElPvhwHcyzUKvg258FggDLLwMY0pG4s/o5F7ALz+KEQGJDeFLLf2CfpZoGw== X-Google-Smtp-Source: AGHT+IHU31S+cbvrobc14SINBYTtUSvid38GaybWCplybMunGZXTdy27P6cjjH91eJ1p1kqu02VR X-Received: by 2002:a17:903:1210:b0:1d9:fc3f:5081 with SMTP id l16-20020a170903121000b001d9fc3f5081mr857554plh.33.1707974460047; Wed, 14 Feb 2024 21:21:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707974460; cv=pass; d=google.com; s=arc-20160816; b=rBOqGxCQnc1//CAP/SNcy5BLzyTKfmQJKy6BrCDHHOgzDUKRQq3kNNa+H0FiB/Zugw 4HhGObT531DaCQxKhHEAeCnd7HV3GBw7zsEL92SDdatyjt8cFpLdiMUpfJO1rDP3ZQok khSAULYedKexOANPRgl8M/6ASc4ipOH8RIyofLrnXs6NGUxAJ0hVyOQ2+jDnPF1VDT28 hTGr1eaUF9YF4wDfS9l16ATbf9xIJWcgfLzAEck/K9AiK0ovEQHnuFn+uf/d8ZdrBs7m u3B8BQ7vhbThmWgO8EAivX+rsaV+iPUCQi43jqgCDB0Xmemh64GSxsXFi6jTerfLEK9W oajQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=Le0RdrbuyjgJwtgv+S4518EI5ef5HEyPTdWzLHN4aO0=; fh=aymk4bFmXSiWc2aJOdE1mGlA7sWkZO5O9tNNmHT7id8=; b=gQk4Mj3HWf5bSmWdugRKDZGZf6d+HQQRaKeVv5Q9UqhmDwh6BojuTEX6uriSogNROa 821HZDoIGv8yymV1p7axXRtyL7sMwHYepPIICdYgd88iT6ZGitSk892+bSc6MdRI8A9M a55m7P6kjpQNbMp/B6kuM6r/859ahUAnRsmSqM8tsvJGuEMhW95Vl+HoeKcw/XuXHisx RiuzfWcHhSmgKyV+YEV+dEDQVAX97pT7IdfYj+uqCuyb2c27QdafOfO0J46Z/hvZT6V2 CE+nKmi/G8mc4eqNnN3npKV5euqzFmNG0ku18FnSjzmy+meVhXgze5/0bzvrD9TXjXCS RuMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-66300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66300-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h12-20020a170902eecc00b001db6da30309si485269plb.530.2024.02.14.21.20.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 21:21:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-66300-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66300-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 9F2D9B261BE for ; Thu, 15 Feb 2024 05:07:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EF0BB675; Thu, 15 Feb 2024 05:06:50 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 86F09539A; Thu, 15 Feb 2024 05:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707973610; cv=none; b=sRoUKV/pTvcJfLDOmhORDDr03ZI5GuWRIklkE9/COIZu37j7tJO++4BauTt30TAMrMmUxauHpHDOfc4u0mjVHm3XGxcZkfLhouweZOLOFKJ8PyfdgFo3fnyJE4t22zFDrD7xDRPos+NBs5WAtj4QqO3moHFWI+HahtM+4mZThbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707973610; c=relaxed/simple; bh=EhSg2QHqNh/t2QONcG+qGuJ0J095P903O68xo1d47Pg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=udiBohXkhwwZAh1uiF0wDJFWBmTJBdPsWGEY6+V1dKGJaIOtazdCMNYnZ84rUY6hd2Hq3xcp3VE1vk5vDHTUOjOaOFAFL4Iuuzen4RfgRGm6VsL19gHCozJMQKdXnH7QBMUbHVQr1kSeRSyYzcQ80TP18RhKGZVv23XpQZoRrNU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 2BDCC67373; Thu, 15 Feb 2024 06:06:43 +0100 (CET) Date: Thu, 15 Feb 2024 06:06:42 +0100 From: Christoph Hellwig To: Robin Murphy Cc: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christoph Hellwig , 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 Subject: Re: [PATCH net-next v3 1/7] dma: compile-out DMA sync op calls when not used Message-ID: <20240215050642.GA4861@lst.de> References: <20240214162201.4168778-1-aleksander.lobakin@intel.com> <20240214162201.4168778-2-aleksander.lobakin@intel.com> <893ad3a4-ba24-43cf-8200-b8cd7742622d@arm.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: <893ad3a4-ba24-43cf-8200-b8cd7742622d@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Wed, Feb 14, 2024 at 05:20:50PM +0000, Robin Murphy wrote: >> +config DMA_NEED_SYNC >> + def_bool ARCH_HAS_SYNC_DMA_FOR_DEVICE || ARCH_HAS_SYNC_DMA_FOR_CPU || \ >> + ARCH_HAS_SYNC_DMA_FOR_CPU_ALL || DMA_OPS || SWIOTLB > > I'm not sure DMA_OPS belongs here - several architectures have non-trivial > ops without syncs, e.g. Alpha. True, but peeking through the ops is a bit hard. And I don't think it's worth optimizing the dma sync performance on Alpha :) >> +static inline void __dma_sync_single_for_cpu(struct device *dev, >> + dma_addr_t addr, size_t size, enum dma_data_direction dir) > > To me it would feel more logical to put all the wrappers inside the #ifdef > CONFIG_HAS_DMA and not touch these stubs at all (what does it mean to skip > an inline no-op?). Or in fact, if dma_skip_sync() is constant false for > !HAS_DMA, then we could also just make the external function declarations > unconditional and remove the stubs. Not a critical matter though, and I > defer to whatever Christoph thinks is most maintainable. Your idea sounds reasonable to me, but I don't have a strong preference. >> +static inline bool dma_need_sync(struct device *dev, dma_addr_t dma_addr) >> +{ >> + return !dma_skip_sync(dev) ? __dma_need_sync(dev, dma_addr) : false; >> +} > > That's a bit of a mind-bender... is it actually just > > return !dma_skip_sync(dev) && __dma_need_sync(dev, dma_addr); > > ? That looks a lot more readable for sure. > (I do still think the negative flag makes it all a little harder to follow > in general than a positive "device needs to consider syncs" flag would.) Probably.