From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 310706BB50 for ; Tue, 20 Feb 2024 14:54:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708440888; cv=none; b=joS10gaVuiBYZjd3XeZnIvzDT/PkB/zwYr60qgHlxwTN2hFbhbTE+HjtWwquB6epoaYZSDAF1klw0YcWaY7XOK7l8tt2ycl/iR0Uu9ZLX28OdFso2py8cQsExBOQFmLN0RS/WpcgLW60MZWWcnhcqmAiV3pmVb6954/8w55uu/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708440888; c=relaxed/simple; bh=t7WKFuVoBIh4h/QQSUN5wp4k+pcVzp6X/vrHWjJLCHg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EWuSPFEHoTNj/bMbIeuHy63ewINugVFHmxgqmU9DlBuaDBWiyy2L/5yo80DY8vdRnrKvXaYkaZiLHK6XtVKtewbhB5cmxt+SH+O0EXvmO+W1wPKGQqTr5R+iKenNRUekKsYp48/gsaURxjwZHcZwMn6hm4E0Hym1C/fCTMZkGdA= 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=df36qAYb; arc=none smtp.client-ip=95.215.58.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="df36qAYb" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708440885; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dSnDrKTQ+lfaKVQJ2Gr6xzNYDhojGRC4cM6fjj3eBR4=; b=df36qAYb/KdV/gQLR8wDkHZ9EIiAfHKyK8etyz2Rvi7VY6Egf8shF00/YZMoHOGqoCA1ju AtFb+FlZIDcuEY+AcwQiyLSw6yYeGpD19fjOdcvNiKcwjK8uiPrVwwra++WWZlsbrVqQxw LUD9LHDGrXj0AMDxhEB/3ph508oJUdY= Date: Tue, 20 Feb 2024 22:54:36 +0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/2] net/mlx5: pre-initialize sprintf buffers To: Yevgeny Kliteynik , Arnd Bergmann , Saeed Mahameed , Leon Romanovsky Cc: Arnd Bergmann , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alex Vesker , Erez Shitrit , Hamdan Igbaria , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240219100506.648089-1-arnd@kernel.org> <2abe3279-ccba-4e1d-a04c-fd724e1660b6@nvidia.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: <2abe3279-ccba-4e1d-a04c-fd724e1660b6@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2024/2/20 14:57, Yevgeny Kliteynik 写道: > On 20-Feb-24 07:50, Zhu Yanjun wrote: >> External email: Use caution opening links or attachments >> >> >> 在 2024/2/19 18:04, Arnd Bergmann 写道: >>> From: Arnd Bergmann >>> >>> The debugfs files always in this driver all use an extra round-trip >>> through an snprintf() before getting put into a mlx5dr_dbg_dump_buff() >>> rather than the normal seq_printf(). >>> >>> Zhu Yanjun noticed that the buffers are not initialized before being >>> filled or reused and requested them to always be zeroed as a >>> preparation for having more reused between the buffers. >> >> I think that you are the first to find this. > > The buffers are not initialized intentionally. > The content is overwritten from the buffer's beginning. > Initializing is not needed as it will only cause perf degradation. If the mentioned functions are not in the critical path, this initialization will not make too much difference on the performance. But if this function knows how many bytes are written and read, it is not necessary to initialize the buffer. Or else we should initialize the buffer before it is used again. Zhu Yanjun > > -- YK > >