Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp668525lqo; Fri, 10 May 2024 10:53:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXorZz/eSw3cfoDvTdRNt9QPZSqfPyGnDikH3Pbkcp6TcSEdA2a0KN5a8Wtm+W9EM9i1VK1QIWNa0fzGWP2qLudP0txn4rieQzX6EcaXw== X-Google-Smtp-Source: AGHT+IEbxnSfwDS3d60qHEFW65J+JXp+l6yblFxZykNXLPCAxpf56hyjmwCq4nWwrl2+R7pUO08p X-Received: by 2002:a17:902:ce8d:b0:1e5:a3b2:4ba3 with SMTP id d9443c01a7336-1ef441a356bmr47676965ad.56.1715363590473; Fri, 10 May 2024 10:53:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715363590; cv=pass; d=google.com; s=arc-20160816; b=0OwG+xA2x4ads1+cYGxkBYf/c5fJnbr8Am/vIANL9L8Um7EZZgby73CtJRMzp8Iuv6 woOjSc/QcqntjyTRuNYKW0eiUXJSuzr6iF/lGFV/cT+X/RQ+ELqTa1t2W4PPzEwcnszI ZXm+aaF6uUaSxJu8etUs1xjptsH01EE6pveo8uhlF8bTStZp6YDzgPy/UiPqwv2kRBOP +A8LkTrfzZVB83FFrEiIrsK0ozvHWq9wXX+K/kwIDJ+kthTrYHWKGCnomRKtXFEXfX/j fiY/yHwqtqPGqgfYYu/HkljoR15LuiHIMJgx7Qarcpbnst3qn1ixf9uu2Bgf7N8aCEZi tcXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=0uz9kAkTJgGLkEuPHjBJeemaGbFiKdidZa6+B1jQ1XA=; fh=pCiac6xvSHZvxWByllCnbX8dfss6o4N87D36Rx+tYNA=; b=vqNhYLGSOuK4GGaLLdQNiPHM/bkkV5Ql1BggBY1Ho7hKaQz1ZeXjSvaq/SySqNKU8r g7PKdhvsmxwzgusHH4+Qjsb+FghbE2M3PZ5juEjcbcmIv2m8Wv43uUCIz0Hw2gLFOmBJ Fzi9lxPq8iqlTMgaQaRQ4cT2EvT3mV3NOBhrr2T5GWLmwdMDpedQO3MQjUTEdz3uXwH7 Kx7SBihtrIFzTJ0rHNwQVoDjpkDqBXf9M31FkN0G/yRMsJr8i2y7CLnQWBW9tT1XeoNV pwls2+GIC2D9ezU70U5qCJ74pH6lkvKt0krQP43wELwPzONOJ18saqeUcMplSETiohvY gJqg==; 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-176070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176070-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 d9443c01a7336-1ef0bf31944si41665445ad.201.2024.05.10.10.53.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 10:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176070-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-176070-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176070-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 0D15B2874B2 for ; Fri, 10 May 2024 17:53:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 536DC1D530; Fri, 10 May 2024 17:53:04 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C5E91BDCF for ; Fri, 10 May 2024 17:53:01 +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=1715363583; cv=none; b=muyEzxt2/yXyVW1rGcCBtq3Dst0Gx9XHOUNi/1myKewPkXjfAEcr+EM7Rwns1UkmjG1N++XUz+1r/XUEA80TeuQNWrLCtuqozCBc7Xx5aSIO98rOckimkfY05Gj2MFZ+qPm7MMVdbX34l87r9vUKpd1g+D8pvCgXoJztT5zlRkQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715363583; c=relaxed/simple; bh=q3TrzDS55l9J6UMQ36bleJhhFObCuaaoaHrIrZTYPyw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aZzFOl1BKgIlXTvhGt8KPYTt5R0grOeqVd2i0YwCZWMhppawrLTK/1n+Udr3tUrpal/gydK4agajd1f46YeGGKEpKGXSqmslAtN842tPwFqbfZn0fMSViisGhdSk5Tv7QfrTPXMojYCkmkPn8wuUuIQilAX4AeuOSHJ1jbzlnTc= 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 E918F339; Fri, 10 May 2024 10:53:25 -0700 (PDT) Received: from [10.57.3.158] (unknown [10.57.3.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 88BE83F6A8; Fri, 10 May 2024 10:52:58 -0700 (PDT) Message-ID: <7dd13232-b5c0-42b1-b096-f374dd9bef85@arm.com> Date: Fri, 10 May 2024 18:52:56 +0100 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 v2 2/4] dma-mapping: benchmark: avoid needless copy_to_user if benchmark fails To: Fedor Pchelkin , Xiang Chen , Barry Song <21cnbao@gmail.com> Cc: Christoph Hellwig , Marek Szyprowski , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org References: <20240504114713.567164-1-pchelkin@ispras.ru> <20240504114713.567164-3-pchelkin@ispras.ru> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20240504114713.567164-3-pchelkin@ispras.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-05-04 12:47 pm, Fedor Pchelkin wrote: > If do_map_benchmark() has failed, there is nothing useful to copy back > to userspace. I guess there could be some valid partial data if for instance it failed due to OOM in the middle of running, but the standard tool is still going to ignore that if the ioctl() returns an error, so meh. Acked-by: Robin Murphy > Suggested-by: Barry Song <21cnbao@gmail.com> > Signed-off-by: Fedor Pchelkin > --- > kernel/dma/map_benchmark.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c > index 2478957cf9f8..a6edb1ef98c8 100644 > --- a/kernel/dma/map_benchmark.c > +++ b/kernel/dma/map_benchmark.c > @@ -256,6 +256,9 @@ static long map_benchmark_ioctl(struct file *file, unsigned int cmd, > * dma_mask changed by benchmark > */ > dma_set_mask(map->dev, old_dma_mask); > + > + if (ret) > + return ret; > break; > default: > return -EINVAL;