Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1326425pxv; Fri, 23 Jul 2021 05:50:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZtATwvzSWt8BeTPhiLFKNtqLJPZ0hYJ+0y8nTAca3dPsRQbQW7jNknIxI9ns192eFHRik X-Received: by 2002:a05:6602:d9:: with SMTP id z25mr3968526ioe.154.1627044613933; Fri, 23 Jul 2021 05:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627044613; cv=none; d=google.com; s=arc-20160816; b=tgoGi5ARofRl2XZju/RFwx3nEb4pGh3gDxMmjepY12CqrePp+9WkRGwEDjLR28+rXe 1dnaqwwMsH829ZohG1d6JZ7A0UO6TY9VzCNhpxl4zqNU8Y/nfH1X+znS6V97FBgnCYye 13QrOwJh+mv6JJusODJJBieB/mFXT03+cp1wzRllh+ey5VjjFSrN46YP1fhXeiQZVBHT zEc9qZycdp/14zHFlMT/SXZ1DEwZhb3G+gznpfgn8Rc2YLcl5mdeefr5PAWNKcJWVtY/ 0leOxwbw7qj+gmSrdpNiZaaQDFOTuqL6ZVoDBtm56Y+mYGXv0KXZbheOgi2Srorxi42g ZbuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=dazTp1qWwBt8f0P3S1WFDeq3IG773W8d1oFnFkyT5/g=; b=n/5c50CSJ1hDbAFR+RoFafNXgQjnMTLyWXje/z2YkHoMW0nhrHU/dOI/dVNVkjqnXM ba5XtvuQQMWCq17plmT3JUxuJ0tw0og6D1qyiJz6nSZE+OpRmlu954vluyZX2PWQxBya UblmivXtk1B20x8qYJbJF53/ewn36VAVrQkWHEonqhABxRFJ7SnSXtguoNPo9oYijWfi DfjMZOpRt8RzBx72sALlSfnPLMPCuZiJGVTUKwcHG2eLn6zZb0lMXVNhbaZQiKoQCw5y 99xXhAU5wQrmUV4myBkrH1hZU58fSLiEBmaRNod9cVElvZF6T5GXcZ1coEXodu0lTyDR SeTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si31169941ilu.148.2021.07.23.05.50.00; Fri, 23 Jul 2021 05:50:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234887AbhGWMIZ convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Jul 2021 08:08:25 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:4024 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234853AbhGWMIY (ORCPT ); Fri, 23 Jul 2021 08:08:24 -0400 Received: from dggems703-chm.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4GWTZV3wcBzmjPd; Fri, 23 Jul 2021 20:45:54 +0800 (CST) Received: from dggemi761-chm.china.huawei.com (10.1.198.147) by dggems703-chm.china.huawei.com (10.3.19.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 23 Jul 2021 20:48:55 +0800 Received: from dggemi761-chm.china.huawei.com ([10.9.49.202]) by dggemi761-chm.china.huawei.com ([10.9.49.202]) with mapi id 15.01.2176.012; Fri, 23 Jul 2021 20:48:55 +0800 From: "Song Bao Hua (Barry Song)" To: "gregkh@linuxfoundation.org" CC: Dave Hansen , "tiantao (H)" , "corbet@lwn.net" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Rafael J. Wysocki" , Peter Zijlstra , "Valentin Schneider" , Dave Hansen , Daniel Bristot de Oliveira , Linuxarm Subject: RE: [PATCH 1/2] CPU, NUMA topology ABIs: clarify the overflow issue of sysfs pagebuf Thread-Topic: [PATCH 1/2] CPU, NUMA topology ABIs: clarify the overflow issue of sysfs pagebuf Thread-Index: AQHXPMXH0SQBD1qG+ECo3ZrOidSRtqrLBimAgADzHOD//4cYAIAAjhuw//+CrICAhVoEQP//gPKAABN7liA= Date: Fri, 23 Jul 2021 12:48:55 +0000 Message-ID: <552730f6c9d046e4bc313abce5714c59@hisilicon.com> References: <1619679819-45256-1-git-send-email-tiantao6@hisilicon.com> <1619679819-45256-2-git-send-email-tiantao6@hisilicon.com> <146e051b-603c-a6d3-43d8-d083cf2c8119@intel.com> <602918a1e2214ea7bd0890a751975566@hisilicon.com> <7c663f7e-07e0-6d95-3012-6e31a1b78f7e@intel.com> <4bf6870f7f3942398e4d1fdaa42184c7@hisilicon.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.200.74] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org] > Sent: Friday, July 23, 2021 11:29 PM > To: Song Bao Hua (Barry Song) > Cc: Dave Hansen ; tiantao (H) ; > corbet@lwn.net; linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; > Rafael J. Wysocki ; Peter Zijlstra ; > Valentin Schneider ; Dave Hansen > ; Daniel Bristot de Oliveira > ; Linuxarm > Subject: Re: [PATCH 1/2] CPU, NUMA topology ABIs: clarify the overflow issue > of sysfs pagebuf > > On Fri, Jul 23, 2021 at 11:20:19AM +0000, Song Bao Hua (Barry Song) wrote: > > > > > > > -----Original Message----- > > > From: Dave Hansen [mailto:dave.hansen@intel.com] > > > Sent: Friday, April 30, 2021 10:39 AM > > > To: Song Bao Hua (Barry Song) ; tiantao (H) > > > ; corbet@lwn.net; gregkh@linuxfoundation.org > > > Cc: linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; Rafael J. > > > Wysocki ; Peter Zijlstra ; > Valentin > > > Schneider ; Dave Hansen > > > ; Daniel Bristot de Oliveira > > > > Subject: Re: [PATCH 1/2] CPU, NUMA topology ABIs: clarify the overflow issue > > > of sysfs pagebuf > > > > > > On 4/29/21 3:32 PM, Song Bao Hua (Barry Song) wrote: > > > > $ strace numactl --hardware 2>&1 | grep cpu > > > > openat(AT_FDCWD, "/sys/devices/system/cpu", > > > > O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 > > > > openat(AT_FDCWD, "/sys/devices/system/node/node0/cpumap", O_RDONLY) = > 3 > > > > openat(AT_FDCWD, "/sys/devices/system/node/node1/cpumap", O_RDONLY) = > 3 > > > > openat(AT_FDCWD, "/sys/devices/system/node/node2/cpumap", O_RDONLY) = > 3 > > > > openat(AT_FDCWD, "/sys/devices/system/node/node3/cpumap", O_RDONLY) = > 3 > > > > > > > > If we move to binary, it means we have to change those applications. > > > > > > I thought Greg was saying to using a sysfs binary attribute using > > > something like like sysfs_create_bin_file(). Those don't have the > > > PAGE_SIZE limitation. But, there's also nothing to keep us from spewing > > > nice human-readable text via the "binary" file. > > > > > > We don't need to change the file format, just the internal kernel API > > > that we produce the files with. > > > > Sorry for waking-up the old thread. > > > > I am not sure how common a regular device_attribute will be larger than > > 4KB and have to work around by bin_attribute. But I wrote a prototype > > which can initially support large regular sysfs entry and be able to > > fill the entire buffer by only one show() entry. The other words to say, > > we don't need to call read() of bin_attribute multiple times for a large > > regular file. Right now, only read-only attribute is supported. > > > > Subject: [RFC PATCH] sysfs: support regular device attr which can be larger > than > > PAGE_SIZE > > > > A regular sysfs ABI could be more than 4KB, right now, we are using > > bin_attribute to workaround and break this limit. A better solution > > would be supporting long device attribute. In this case, we will > > still be able to enjoy the advantages of buffering and seeking of > > seq file and only need to fill the entire buffer of sysfs entry > > once. > > No, please no. I WANT people to run into this problem and realize that > it went totally wrong because they should not be having more than one > "value" in a sysfs file like this. > > Let's not make it easy on people please, moving to a bin attribute is a > big deal, let's keep it that way. Ok. Got it. Thanks for clarification. That was the experiment I made recently when I almost got totally stuck. > > thanks, > > greg k-h Thanks Barry