From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17899325490 for ; Sat, 27 Jun 2026 17:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782582571; cv=none; b=R9shBHKPAF5kvbbSDUhwXuqRyWmQFVMj08/J9bAxmB3/3HOPvrYQHNg2FooWi1WwzKm2mk9rrzfgbcKBw9qqxEE/v8JFKjnvtZ5LmUwvFOiNRzvfSHJjFZkEFG5dVgXcOLBilgtE+QwXcvEXXU13ZMFY9y84ll2x9RHVy0fQcTk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782582571; c=relaxed/simple; bh=YA+1i/UnBYMi612cEFEOy+3MzER+Xfj7iA6l8jGXb4M=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uqBWml+sZkZLyg3tgy3QWUrv+O87pvRvuZ80rDtczf5Wgo6yto2O9I/3FkFj/I+vhxgFODDK2NfOTzrlCZA2Jf6Ma0Q2cxq0emG7r4fRbVPkP/4UBoQKuhzsPUWPYpC5apcJmHKqjk27WwGuY+hwyQUVSRZrQ70/uoTpSELuNvI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D+APVrVB; arc=none smtp.client-ip=209.85.217.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D+APVrVB" Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-734dfaa3d9bso1368707137.3 for ; Sat, 27 Jun 2026 10:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782582569; x=1783187369; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=+uflCN5dEoFADXWjqBtV9JZXNhAeBkbLG/4dD0z7b4I=; b=D+APVrVB7sDaioieVdmISDPXpLFAuW6Z8ACka+jIwp7ns0TQdWs5MEy+Z/dxvn8VAa e29T4yf7lV++S7Zg1KPGSJLqvjfqzUAvUEu7tSGmqaCsQogJoe9MO5ZfM/HH/GhY8ux0 YW6ZINIMDlm8qugBnJpjrCnTOHTSXKlAPJF11MzR2txP/MrDTMvFDy0oCu+HsC/1rWic 5RnQmKwAXJpxLkTmgZLfBFUKtZnCgcM2yM4bDprDEVL6jHCMPi1e3zAqIe9XmKpm9HEA GY5jXZXmdNMNEJwgCkWWPPLSrpsmhX+cbfcTpaZTE+Q/IJm4Gxe+tsxjkBwBxlPFhi9j 4y8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782582569; x=1783187369; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+uflCN5dEoFADXWjqBtV9JZXNhAeBkbLG/4dD0z7b4I=; b=FbE2fOHigSrjEmfsLA7CveRju3YNJ3LqthN5h7UuAs4A4RLm+Tv/htHzxfNPQq8DiM M1jqk7lqv6dP5Cg12OlFz1gKId3ha5twfgyaUlp0940FrDZfqap4eAiau0psrJ23rUHi HxC2xjSGNhBn3N10qSGGnS5IhWJcpYOpRec7wrlsQIknz/tRj13717h2bEibtv7QAeso uECOj7WV0RDscn62AjcwwPTBRd3u94GKKm4+3SvQ8iguihsjCeDWpfL7HIR1oBoXMDdM ICDbL5ul43Qqo2ajbWEuIekVeNYb5dpQqOvYJqV5wDQ21dBy+qk2ewZfacJ/hM85Ga8Q dQRw== X-Forwarded-Encrypted: i=1; AHgh+RqA/XD428ACEf1ZzJz72q9xTjH7l/A9BzYt+M4sfu0UKYysfkkHlvaLdqSAg2B3KNBZa9AuqMxiBnHotDV5@vger.kernel.org X-Gm-Message-State: AOJu0YzwtFrzyrQ3cstJuKHOVDIQgVUkUv2Vsn8TSCxXYch++aBuCGWg hmqV/03M4igOgVk1082+m/xsCjY2RpqwUqgsMRWAzRzkD/VKxzNF6eAp X-Gm-Gg: AfdE7cmgUO4Pnb2pIwLKEgmaiHwXsVpv9MxVY36xxw7lf8sefOcjamoSGbA4STH00mh OhaycXd95fjQKTSlbDtyAUN9yyZhU6i+KKyg0UI9jOg3yrIhuRWUBq9qzhAjZO6PM+iJKYKbEEa +CfpvGNYucjYeKSNhMps7vsypNL4JaIDNGPfxMOWDH2pPmRFgwP8ov4WJhMvVLZ4aQTJul0JAoH SzPJcI+pq3YyvZCmwFupcIxMjUg4PCGk8fTMUWjH0DeEsR/4ERRN1GNlljmSzZPIOerH55JmzYQ DSC3QKbVZfByCM39wOWEH2bLv8rOkoBdJsQBQaU/nkaEhuw67DSbUELPognpc0F1SffN8jzzwWB q4DmF2gU3apQjv5lMm+ayHPsOZi95NFyUfxjBKbj7CJl3XMSq7g+ajFjpJudEDKYQaXlvqOrJ7h ffZ+rfxujOOKn0VZJqRQnY3c5P3m6QZe3AKIufUNGxuSO/ X-Received: by 2002:a05:6102:440f:b0:730:db02:1d08 with SMTP id ada2fe7eead31-73434452fd5mr5471882137.10.1782582569056; Sat, 27 Jun 2026 10:49:29 -0700 (PDT) Received: from localhost (d-24-145-72-22.fl.cpe.atlanticbb.net. [24.145.72.22]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-96916e5b10dsm2811280241.4.2026.06.27.10.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2026 10:49:28 -0700 (PDT) From: Yury Norov X-Google-Original-From: Yury Norov Date: Sat, 27 Jun 2026 13:49:27 -0400 To: David Laight Cc: Robin Murphy , Andrew Morton , Rasmus Villemoes , Russell King , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Thomas Gleixner , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Heiko Stuebner , Lorenzo Pieralisi , Xu Yilun , Tom Rix , Moritz Fischer , Yicong Yang , Jonathan Cameron , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Bjorn Helgaas , Shuai Xue , Will Deacon , Jiucheng Xu , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jing Zhang , Xu Yang , Linu Cherian , Gowthami Thiagarajan , Ji Sheng Teoh , Khuong Dinh , Daniel Lezcano , Zhang Rui , Lukasz Luba , Yury Norov , Kees Cook , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Aboorva Devarajan , "Ritesh Harjani (IBM)" , Ilkka Koskinen , Besar Wicaksono , Ma Ke , Chengwen Feng , linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-perf-users@vger.kernel.org, linux-acpi@vger.kernel.org, driver-core@lists.linux.dev, linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-fpga@vger.kernel.org, linux-rdma@vger.kernel.org, nvdimm@lists.linux.dev, linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-cxl@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 13/16] perf: Use sysfs_emit() for cpumask show callbacks Message-ID: References: <20260528183625.870813-1-ynorov@nvidia.com> <20260528183625.870813-14-ynorov@nvidia.com> <7e980b99-1e4e-408b-8ebd-4d28116e7ad5@arm.com> <20260529130619.12f24264@pumpkin> Precedence: bulk X-Mailing-List: linux-arm-msm@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: <20260529130619.12f24264@pumpkin> On Fri, May 29, 2026 at 01:06:19PM +0100, David Laight wrote: > On Fri, 29 May 2026 12:05:08 +0100 > Robin Murphy wrote: > > > On 2026-05-28 7:36 pm, Yury Norov wrote: > > > These callbacks are sysfs show paths. > > > > > > Use sysfs_emit() and cpumask_pr_args() to emit the masks. > > > > > > This prepares for removing cpumap_print_to_pagebuf(). > > > > TBH, looking at this diff I think it only shows the value of having a > > helper to abstract the boilerplate... > > > > I'm not sure I agree with the argument of removing something entirely > > just because it may occasionally be misused, but could we at least have > > something like: > > > > #define sysfs_emit_cpumask(buf, mask) \ > > sysfs_emit((buf), "%*pbl\n", cpumask_pr_args(mask)) > > > > to save the mess in all the many places where the current > > cpumap_print_to_pagebuf() usage _is_ entirely appropriate? This way you have to add 2 wrappers: #define sysfs_emit_cpulist(buf, mask) \ sysfs_emit((buf), "%*pbl\n", cpumask_pr_args(mask)) and #define sysfs_emit_cpumask(buf, mask) \ sysfs_emit((buf), "%*pb\n", cpumask_pr_args(mask)) There are people who complain even about DIV_ROUND_UP(), how hard it is to keep all that helpers in memory, and all that things. https://lore.kernel.org/all/20260304124805.GB2277644@noisy.programming.kicks-ass.net/ Disagree about DIV_ROUND_UP() (because yeah, I'm bad in math), but this sysfs_emit_cpumask() is a complete syntax redundancy. Once we have it, people will do this type of things: tmp = kmalloc(PAGE_SIZE); sysfs_emit_cpumask(tmp, mask); sysfs_emit(buf, "my prefix: %s\n", tmp); kfree(tmp); Patch #1 in this series is one example. My series that removes bitmap_print_to_pagebuf() will give you more: https://lore.kernel.org/all/20260303200842.124996-2-ynorov@nvidia.com/ It doesn't mean that *you* will misuse the API. It means that *I* will have to inspect the codebase for that type of bugs periodically. So, the overall state is simple: we've got well-established printf()-like functions that people know and understand, and we also have exotic APIs here and there with a non-standard interface and a clear potential to misuse. In this case, they have historical roots, but now we don't need them. > That has the advantage of letting you change how it is done (again) > without having to find all the callers. You mean things like silencing the prints or adding a prefix? If you believe that perf subsystem would benefit from it - that's OK. Just please keep it local. The kernel globally doesn't need to 'change how it is done' beyond the lib/vsprintf. The kernel really needs people to use something that the other people are familiar with. Thanks, Yury From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98CF8C43602 for ; Sat, 27 Jun 2026 17:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=y4H5lJi8Fv4+TgS+lkwzpzMi/R/v5KnDJoLjIy9B8hM=; b=NHfWYXqicV3IuJ xERt+h0CACT+IW3Cgi6XphZ3kRCbKQTvsRaakRDLCAmEBRyRTjcnO1gEFCFbmHPIwYPVqxqkaVyX2 x+sEwj2LCCENKNivrzY4M6412wcQ+Vne1K3E4Np8CMVgBGxpXHxhA72+g+fqYJGsLq3X+k2+qL2wO TKpMKH2j2Vp76Ha5+BqJvv8WUZzXoSzClDb1O5mL+clv0WuzlVzU4IClKZ/+321mFCgS3qjqeEnS7 xoSXaiZU0Gj9HVu4YUAiaJFu1ez3XeMmOpfP3qO3IDOTNH0zOonhWKzcqZneMzIJwcn2AnPX/CTXM DdpQnyorzHyRq7NK7akA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wdX9q-0000000Cg4w-0pjl; Sat, 27 Jun 2026 17:49:34 +0000 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wdX9m-0000000Cg3i-3s5y for linux-amlogic@lists.infradead.org; Sat, 27 Jun 2026 17:49:32 +0000 Received: by mail-vs1-xe35.google.com with SMTP id ada2fe7eead31-7353fc918d9so1497243137.2 for ; Sat, 27 Jun 2026 10:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782582569; x=1783187369; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=+uflCN5dEoFADXWjqBtV9JZXNhAeBkbLG/4dD0z7b4I=; b=enbq5aJmBRgE9Dwx5N2J4LBd0rGu3SBnGF/8e8ZT0vzjDuc7N/nkirSWLPJUucVMaW gT5+h+rqL/qkc8cakQxBnN9niJYs1A5+ln0eM24yy/BiKHjPwVjhF+a4BtVN9EYeDrMr Cg1kpcOzXP7+9o0Ae8io9sV4YRW6hV1PSA2GHYGT8PAVNYuGbU3a3JPfEMThh5bz1Qdf 4LvgCsNlFd3toBQMfCoRNd+0NQuuLZn22qmE8BwarV3etA3GNp7QWfTYyN3Lq8MwKHnx r1n7neInRdYHLPTmKTCXmqyQ766pLELIhGHV2ryG3Bj87WotgJN+c7yNtqNY8iz+3iNA o6kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782582569; x=1783187369; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+uflCN5dEoFADXWjqBtV9JZXNhAeBkbLG/4dD0z7b4I=; b=WYhVFE5Af5j2QnSCuXUHQ4def+8DUzXANB2ulue4oEjVv04ZMixO8flmcetaqXjP+Q c74kEZhQsB+ee6IJAg277j/XGyD1mLb/LwZJ8YfmaS3XwrTfZDGE+HwpBbIlz0V4cHlY ubTlydjxebx643WYMXaoNJhHF4da0V4xI6EBRDb+xLavT1xN8t7NcQB4NMc88XRiLYqX 5+dwUSleriXu3QEQS+x24BjJFEkCTtn+pfxkmQhCtE9NbbJuvYUDIls7EWQKvHAk9m9l tk6A2XXHBFieUb+p49B0gJa5fg0+RGUFhoCBM3GHlf0khmk3Gy8Uuxr337Hs9PyrXrmM 65Jg== X-Forwarded-Encrypted: i=1; AHgh+Rq0fHt+E/k3BNt26ucHNA8DuACf6Dp3hnaLCkqtepg0cdVkC1wQg7kkgHeDiXip30hUZtxtnm7pAIY/hqM6@lists.infradead.org X-Gm-Message-State: AOJu0Yz2s1jc2M9YXOLwoVrIsDZF/EUSuGPRzg6tc7HuPrv0GIFo4hkR enguxUJoLCgMbqaHfl9v9P8dxQzVxZIQc9Ry92Lerc/FT4Ju84rJpTGx X-Gm-Gg: AfdE7cmsbEEEgu3DKuuq0pD1XXL/aWyiXNm/cZCLVi//6GfKw1eNsQFJrGa3A8p2Sz1 icn5KRdWZ35bOdqYJwlUDVfKlPPIZWBlPThtXGkMGFKZGBF3m96DkXRSfoTIkpLRrN+UwDat7K6 lipt3QnJ768asPqvvnssAIqWl44Gr/RUzkCKcM4V9HS7WsZySNj02Of4dUJAUCMoAEQM41fHfXp dqxl2S4zhM7azjHl+fur3QylsC4b8j3z4EiqEBwktED+UfY0aaBZYeHbyjnoiGpLacne5ybzPWJ UrKFs4lTb7vwgdwnmRWDPSaljY0aKdsz2esa5S8WrND1E9cKZiHJWZ1k+kCDKKL1Rm+qnqRNmud J/z6ShOPO8A0IS99gr4wfQAhmEq8eaIOq75Kue42c+ErUZgROUA8Xb26wukX7mFxIwYCzlYPaVD 0LuNZBd1+ir9sOmLl3MpKl+uSHrgU1PVllNKVX5PdWPttL X-Received: by 2002:a05:6102:440f:b0:730:db02:1d08 with SMTP id ada2fe7eead31-73434452fd5mr5471882137.10.1782582569056; Sat, 27 Jun 2026 10:49:29 -0700 (PDT) Received: from localhost (d-24-145-72-22.fl.cpe.atlanticbb.net. [24.145.72.22]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-96916e5b10dsm2811280241.4.2026.06.27.10.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2026 10:49:28 -0700 (PDT) From: Yury Norov X-Google-Original-From: Yury Norov Date: Sat, 27 Jun 2026 13:49:27 -0400 To: David Laight Cc: Robin Murphy , Andrew Morton , Rasmus Villemoes , Russell King , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Thomas Gleixner , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Heiko Stuebner , Lorenzo Pieralisi , Xu Yilun , Tom Rix , Moritz Fischer , Yicong Yang , Jonathan Cameron , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Bjorn Helgaas , Shuai Xue , Will Deacon , Jiucheng Xu , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jing Zhang , Xu Yang , Linu Cherian , Gowthami Thiagarajan , Ji Sheng Teoh , Khuong Dinh , Daniel Lezcano , Zhang Rui , Lukasz Luba , Yury Norov , Kees Cook , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Aboorva Devarajan , "Ritesh Harjani (IBM)" , Ilkka Koskinen , Besar Wicaksono , Ma Ke , Chengwen Feng , linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-perf-users@vger.kernel.org, linux-acpi@vger.kernel.org, driver-core@lists.linux.dev, linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-fpga@vger.kernel.org, linux-rdma@vger.kernel.org, nvdimm@lists.linux.dev, linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-cxl@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 13/16] perf: Use sysfs_emit() for cpumask show callbacks Message-ID: References: <20260528183625.870813-1-ynorov@nvidia.com> <20260528183625.870813-14-ynorov@nvidia.com> <7e980b99-1e4e-408b-8ebd-4d28116e7ad5@arm.com> <20260529130619.12f24264@pumpkin> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260529130619.12f24264@pumpkin> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260627_104930_978773_A7C5966F X-CRM114-Status: GOOD ( 25.29 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On Fri, May 29, 2026 at 01:06:19PM +0100, David Laight wrote: > On Fri, 29 May 2026 12:05:08 +0100 > Robin Murphy wrote: > > > On 2026-05-28 7:36 pm, Yury Norov wrote: > > > These callbacks are sysfs show paths. > > > > > > Use sysfs_emit() and cpumask_pr_args() to emit the masks. > > > > > > This prepares for removing cpumap_print_to_pagebuf(). > > > > TBH, looking at this diff I think it only shows the value of having a > > helper to abstract the boilerplate... > > > > I'm not sure I agree with the argument of removing something entirely > > just because it may occasionally be misused, but could we at least have > > something like: > > > > #define sysfs_emit_cpumask(buf, mask) \ > > sysfs_emit((buf), "%*pbl\n", cpumask_pr_args(mask)) > > > > to save the mess in all the many places where the current > > cpumap_print_to_pagebuf() usage _is_ entirely appropriate? This way you have to add 2 wrappers: #define sysfs_emit_cpulist(buf, mask) \ sysfs_emit((buf), "%*pbl\n", cpumask_pr_args(mask)) and #define sysfs_emit_cpumask(buf, mask) \ sysfs_emit((buf), "%*pb\n", cpumask_pr_args(mask)) There are people who complain even about DIV_ROUND_UP(), how hard it is to keep all that helpers in memory, and all that things. https://lore.kernel.org/all/20260304124805.GB2277644@noisy.programming.kicks-ass.net/ Disagree about DIV_ROUND_UP() (because yeah, I'm bad in math), but this sysfs_emit_cpumask() is a complete syntax redundancy. Once we have it, people will do this type of things: tmp = kmalloc(PAGE_SIZE); sysfs_emit_cpumask(tmp, mask); sysfs_emit(buf, "my prefix: %s\n", tmp); kfree(tmp); Patch #1 in this series is one example. My series that removes bitmap_print_to_pagebuf() will give you more: https://lore.kernel.org/all/20260303200842.124996-2-ynorov@nvidia.com/ It doesn't mean that *you* will misuse the API. It means that *I* will have to inspect the codebase for that type of bugs periodically. So, the overall state is simple: we've got well-established printf()-like functions that people know and understand, and we also have exotic APIs here and there with a non-standard interface and a clear potential to misuse. In this case, they have historical roots, but now we don't need them. > That has the advantage of letting you change how it is done (again) > without having to find all the callers. You mean things like silencing the prints or adding a prefix? If you believe that perf subsystem would benefit from it - that's OK. Just please keep it local. The kernel globally doesn't need to 'change how it is done' beyond the lib/vsprintf. The kernel really needs people to use something that the other people are familiar with. Thanks, Yury _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DFFCAC4450E for ; Thu, 9 Jul 2026 08:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KRmUIO8aexmF3fSN5qIWDBaEsI+qy+e9oxI/dZqR6Lk=; b=bzCARX/TTb2YbK anWlgfdpkqLg4RpVfQ6+hbiUf2C58LlbOUJC2yIYfMX9Qan2GN2d9YGv/3ECZGk9hDCNg2XOHDFJR JzS/5vkyXEfcPLdHxdVs0gfMOVBwu0VmpSBeV4fB97PIHxVto1Db4WQCFqSG02KgmjDmdNJXFtcDU 1yqUR4g/xvD5nIRYgmQyx4IWcBLOVw2eHt57jviAUZLsaIlW1aRGvlZmhBP2T2FMOixjfiLeM0avV 2Ba/3g5E+MJgDRdLTesl0JmrUfMWaSa0JlzKSk7c64qm+F0y1rZ9iozPH/vwliyhRqD2MDIleLNFu SsNUY+qoqkgJL0tFutpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whkVP-00000001abj-2Oat; Thu, 09 Jul 2026 08:53:15 +0000 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wdX9m-0000000Cg3h-3ghY for linux-rockchip@lists.infradead.org; Sat, 27 Jun 2026 17:49:32 +0000 Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-734dfaa3d9bso1368709137.3 for ; Sat, 27 Jun 2026 10:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782582569; x=1783187369; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=+uflCN5dEoFADXWjqBtV9JZXNhAeBkbLG/4dD0z7b4I=; b=enbq5aJmBRgE9Dwx5N2J4LBd0rGu3SBnGF/8e8ZT0vzjDuc7N/nkirSWLPJUucVMaW gT5+h+rqL/qkc8cakQxBnN9niJYs1A5+ln0eM24yy/BiKHjPwVjhF+a4BtVN9EYeDrMr Cg1kpcOzXP7+9o0Ae8io9sV4YRW6hV1PSA2GHYGT8PAVNYuGbU3a3JPfEMThh5bz1Qdf 4LvgCsNlFd3toBQMfCoRNd+0NQuuLZn22qmE8BwarV3etA3GNp7QWfTYyN3Lq8MwKHnx r1n7neInRdYHLPTmKTCXmqyQ766pLELIhGHV2ryG3Bj87WotgJN+c7yNtqNY8iz+3iNA o6kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782582569; x=1783187369; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+uflCN5dEoFADXWjqBtV9JZXNhAeBkbLG/4dD0z7b4I=; b=ZfBpCRwkerxGoASNmnMK8NJMJcK7hli32ghup0pqcY8TMU1bAh5MIlTTyy/Nj48cwW 3z3TOO10XWg6zI8gptHnrqXfAtgGNVBt5aGOMnKolfLTCWWgVcAxauJ6aUQZU4nPoQ8A vj5IiAVuIk3eAjukLwuET5P6y8v3tcvip6h2xvggiakRJjwzSeQG++MmcuOYupPG7rIl ajcqYotjek2zM6IIq07Kip3q6M255e/6bCBUhNbv5l88h6NdvtlV8zYfa5AGnsqPlJiy j5tYlVREK/jkGqnDpz9CDPi01g9K+DcH4MB2YSKZNcd2KkNe8Phd6OXXidit1CAZtNKN ac8w== X-Forwarded-Encrypted: i=1; AHgh+Rq/72BjNV6kS0uXx+VMDkSM4MGdLQES+DUBqGTrPwDyzvvTZ4mRXXEI1c2/0/gi4ORsG660JxmDjKm57Z4pEg==@lists.infradead.org X-Gm-Message-State: AOJu0YwyRLbbaFqXVHXC3VWdGMHssD4u/EY1My6UIRNvH/loxVoELOei I6HdG8cURcSijSfUKjEjga400NTNnz2bK5WqEpOTledTTL35NBDRE9ZI X-Gm-Gg: AfdE7cllKeauNTg9Okiw2h70OpcWGhuCAa16n8e7l9l76pkrXu52yqJktGFrPzpINmn cbKSrhEUU9PYtF9AWhSvQp9/CLTEns44ELI4WsymxJTQkxw8fXmFFJnObpiI18ggLj9cJZyU7ME tcYWezJjGXPZXg71gb4+GDG0neSlMx2CD8MeKmSd5uXmP6sidsqdKLHEZQIYFqAapF7yNoRmCau 9jOyig8yTqVO7qWnqi9AxzdYmfa0aleUNzeDMvhsisC+ko8RCd2rAR9JsCO0fZCbJqhiQWMl5t5 f1ceErNcowFYLAduRPp2R090NsvBlqHYL2bJzfdWLDasIipr9xMAnmgLGekMUWEprxmtJ5IN1R1 zIcjit9lssiAshHMXZS2W9GTEMb6s6tfFga8OIE+0IGRSX39BHtos1XcJtat+ETvCv5otf27hnw jKmQzb/20JbJ+/ZVAfZG2vUuI/ktLyra4UnlQ2EIlVEy8Q X-Received: by 2002:a05:6102:440f:b0:730:db02:1d08 with SMTP id ada2fe7eead31-73434452fd5mr5471882137.10.1782582569056; Sat, 27 Jun 2026 10:49:29 -0700 (PDT) Received: from localhost (d-24-145-72-22.fl.cpe.atlanticbb.net. [24.145.72.22]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-96916e5b10dsm2811280241.4.2026.06.27.10.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2026 10:49:28 -0700 (PDT) From: Yury Norov X-Google-Original-From: Yury Norov Date: Sat, 27 Jun 2026 13:49:27 -0400 To: David Laight Cc: Robin Murphy , Andrew Morton , Rasmus Villemoes , Russell King , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Thomas Gleixner , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Danilo Krummrich , Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Heiko Stuebner , Lorenzo Pieralisi , Xu Yilun , Tom Rix , Moritz Fischer , Yicong Yang , Jonathan Cameron , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Bjorn Helgaas , Shuai Xue , Will Deacon , Jiucheng Xu , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Jing Zhang , Xu Yang , Linu Cherian , Gowthami Thiagarajan , Ji Sheng Teoh , Khuong Dinh , Daniel Lezcano , Zhang Rui , Lukasz Luba , Yury Norov , Kees Cook , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Aboorva Devarajan , "Ritesh Harjani (IBM)" , Ilkka Koskinen , Besar Wicaksono , Ma Ke , Chengwen Feng , linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-perf-users@vger.kernel.org, linux-acpi@vger.kernel.org, driver-core@lists.linux.dev, linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-fpga@vger.kernel.org, linux-rdma@vger.kernel.org, nvdimm@lists.linux.dev, linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-cxl@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 13/16] perf: Use sysfs_emit() for cpumask show callbacks Message-ID: References: <20260528183625.870813-1-ynorov@nvidia.com> <20260528183625.870813-14-ynorov@nvidia.com> <7e980b99-1e4e-408b-8ebd-4d28116e7ad5@arm.com> <20260529130619.12f24264@pumpkin> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260529130619.12f24264@pumpkin> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260627_104930_938678_166192DF X-CRM114-Status: GOOD ( 25.50 ) X-Mailman-Approved-At: Thu, 09 Jul 2026 01:48:23 -0700 X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Fri, May 29, 2026 at 01:06:19PM +0100, David Laight wrote: > On Fri, 29 May 2026 12:05:08 +0100 > Robin Murphy wrote: > > > On 2026-05-28 7:36 pm, Yury Norov wrote: > > > These callbacks are sysfs show paths. > > > > > > Use sysfs_emit() and cpumask_pr_args() to emit the masks. > > > > > > This prepares for removing cpumap_print_to_pagebuf(). > > > > TBH, looking at this diff I think it only shows the value of having a > > helper to abstract the boilerplate... > > > > I'm not sure I agree with the argument of removing something entirely > > just because it may occasionally be misused, but could we at least have > > something like: > > > > #define sysfs_emit_cpumask(buf, mask) \ > > sysfs_emit((buf), "%*pbl\n", cpumask_pr_args(mask)) > > > > to save the mess in all the many places where the current > > cpumap_print_to_pagebuf() usage _is_ entirely appropriate? This way you have to add 2 wrappers: #define sysfs_emit_cpulist(buf, mask) \ sysfs_emit((buf), "%*pbl\n", cpumask_pr_args(mask)) and #define sysfs_emit_cpumask(buf, mask) \ sysfs_emit((buf), "%*pb\n", cpumask_pr_args(mask)) There are people who complain even about DIV_ROUND_UP(), how hard it is to keep all that helpers in memory, and all that things. https://lore.kernel.org/all/20260304124805.GB2277644@noisy.programming.kicks-ass.net/ Disagree about DIV_ROUND_UP() (because yeah, I'm bad in math), but this sysfs_emit_cpumask() is a complete syntax redundancy. Once we have it, people will do this type of things: tmp = kmalloc(PAGE_SIZE); sysfs_emit_cpumask(tmp, mask); sysfs_emit(buf, "my prefix: %s\n", tmp); kfree(tmp); Patch #1 in this series is one example. My series that removes bitmap_print_to_pagebuf() will give you more: https://lore.kernel.org/all/20260303200842.124996-2-ynorov@nvidia.com/ It doesn't mean that *you* will misuse the API. It means that *I* will have to inspect the codebase for that type of bugs periodically. So, the overall state is simple: we've got well-established printf()-like functions that people know and understand, and we also have exotic APIs here and there with a non-standard interface and a clear potential to misuse. In this case, they have historical roots, but now we don't need them. > That has the advantage of letting you change how it is done (again) > without having to find all the callers. You mean things like silencing the prints or adding a prefix? If you believe that perf subsystem would benefit from it - that's OK. Just please keep it local. The kernel globally doesn't need to 'change how it is done' beyond the lib/vsprintf. The kernel really needs people to use something that the other people are familiar with. Thanks, Yury _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip