Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp727819pxv; Thu, 15 Jul 2021 14:37:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIGds6cjqpSD/t+eZzKOx1OBIfambi+yauNbt/pqVYsKU0tvFo5x50nG57VMDy30YMzQ+Q X-Received: by 2002:a05:6402:1a3c:: with SMTP id be28mr9819281edb.15.1626385048162; Thu, 15 Jul 2021 14:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626385048; cv=none; d=google.com; s=arc-20160816; b=b2NA+rg7BII0WRxvhINeO4+WNhsJvf3xVK/vUdLkl+GzbiMbZG0tMe7I6Rzn6BAX75 V2SxCI/pG22vZK9zFevB54H5Fbsw24H6DoLaR+C3guPcUIejN/q8VBsAjVjf9BrrIK0/ N1cYAjCLv6Vyb9Ig4HHEpHpjtaHcRg3Ba5B/AkWJ1iWiA32cnDyqifD3+1FC0g7iVsEG sEa2yW1FN0Y2uFCQMIhpXYaFsArdycWKjXLse4Y1BnJcvOX1SXdY7mB6ULX5jXiYCKse i+XH/j7T3WCVO01d17hSq+LZa3aaSAxOWlcXUJ/Es0rv5IjtqNo7Bf5rho1iVrMJhn0h ROnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Zn4Tf8PL7zNftVDiLUo9rrZ9NLkeTwR/wjn2FJ4Gcps=; b=nxcocpsjji+95NUmsWrpEQEnGeWD+K9s7B2TcvjXEm8HvtF+af4l/cdHBUEGu5pprp GRu4d1Ksr9Oo2d4J+ndhSe3KzV3jmrQGocMZiW2fjt4UxINGfQA9wGBvOCBRGhFr0KFR Ix6stqeROYF7ll12wkzHlBpgxlFkmPustfqvzzTvOleEWklrG0nlHxbqX4CvAL9gK85u 0yBvUg1EC6ARZxM6KAB+AoT+IytcEGh8Ue1fJutGGnsZqVl++nCADQeWaFNpkcuZpXaF CGFh7ZjMmHmZghnf930GaqKWVh4K4uBqQFQl7eI8LO/0CNU5yyOB0kZPWDorC1dZRgMy Kmlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jJ5R1kkD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si9466524edr.231.2021.07.15.14.37.04; Thu, 15 Jul 2021 14:37:28 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jJ5R1kkD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231871AbhGOVgR (ORCPT + 99 others); Thu, 15 Jul 2021 17:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbhGOVgQ (ORCPT ); Thu, 15 Jul 2021 17:36:16 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3AD9C06175F for ; Thu, 15 Jul 2021 14:33:22 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id q10so6783363pfj.12 for ; Thu, 15 Jul 2021 14:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Zn4Tf8PL7zNftVDiLUo9rrZ9NLkeTwR/wjn2FJ4Gcps=; b=jJ5R1kkDqAcnQIFNtadt6Xq81B97HQlBqc/zOHhj87jGYev8DqssW3J2kZ7mMXa1uj b0jdIBDawjgcaq0HvKAeXo+iKjqUd4naGTKq3s9RuxD68kAiT0cwKOBOG+jqEStm00Se W1KCx3VFTUeuYu7M5/mT31fOX1WNHpYXkDSNBJk5sRF43aZrfh23TMY3pSvMcz9YEVhe qrkHe8/jHLS8uhsmLgaL/0WRMDXpRx5Tfdx1hUvLAJlUeHoNmS1sbc8JIE2vZyvcnzJY QV6MtwEFvM3bgvluZWmp0KHqI9eTzPynOq+fwB4BkPv0W+MRzOlPnmqTwjswPJPwhMhy M7/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zn4Tf8PL7zNftVDiLUo9rrZ9NLkeTwR/wjn2FJ4Gcps=; b=K5Loe2q9Bf8gzWBTfkOs/hRYmhMlYE+NNfxuJ+HPZ8E/fpIFvthEnmwY6jYIDhjXa8 RKk05GmhGO93bNMZVLSSchRLawB4NFazHEmLG+eDxxdi7ZodWjr6utWB/sB4F9BKWSGk 9/oDKv/VHZRAMxPs0292KM3XRZTsyjwUmrRbwtuMgEuiB0OCqfJ0869SujTmUyGwpa8k CpO9lR0UlX+2Ul5lMdWQ0HkG2/p/fkl3EK/0ZbS0eFHYuKZ/qVRdCJxyH9ijlurAbop9 J+TBda7Hs8GzQDZFSvjbBVCBtU+u0aAP4mUsbEmqJ1UaMeff3i9sU84hVh2NqSyJtQVf nGsA== X-Gm-Message-State: AOAM531mlT7gty6bD4A1NbMUu5OYDpdPb3/LKIlaz/rPOakxh/zxsC1K 65MbqeiOZvVP8e3uY9yrMTxSy91qCoyhYiRBjDU= X-Received: by 2002:aa7:8a04:0:b029:332:950e:d976 with SMTP id m4-20020aa78a040000b0290332950ed976mr6662152pfa.40.1626384802498; Thu, 15 Jul 2021 14:33:22 -0700 (PDT) MIME-Version: 1.0 References: <20210715115856.11304-1-song.bao.hua@hisilicon.com> <20210715115856.11304-5-song.bao.hua@hisilicon.com> In-Reply-To: From: Andy Shevchenko Date: Fri, 16 Jul 2021 00:32:45 +0300 Message-ID: Subject: Re: [PATCH v7 4/4] lib: test_bitmap: add bitmap_print_to_buf test cases To: Yury Norov Cc: Andy Shevchenko , Barry Song , Greg Kroah-Hartman , Andrew Morton , Linux Kernel Mailing List , Dave Hansen , Rasmus Villemoes , "Rafael J. Wysocki" , Randy Dunlap , Alexander Gordeev , Stefano Brivio , "Ma, Jianpeng" , Valentin Schneider , "Peter Zijlstra (Intel)" , Daniel Bristot de Oliveira , Guodong Xu , tangchengchang@huawei.com, "Zengtao (B)" , yangyicong , tim.c.chen@linux.intel.com, Linuxarm Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 11:48 PM Yury Norov wrote: > On Thu, Jul 15, 2021 at 03:09:39PM +0300, Andy Shevchenko wrote: > > On Thu, Jul 15, 2021 at 11:58:56PM +1200, Barry Song wrote: > > > The added test items cover both cases where bitmap buf of the printed > > > result is greater than and less than 4KB. > > > And it also covers the case where offset for bitmap_print_to_buf is > > > non-zero which will happen when printed buf is larger than one page > > > in sysfs bin_attribute. > > > > More test cases is always a good thing, thanks! > > Generally yes. But in this case... I believe, Barry didn't write that > huge line below by himself. Most probably he copy-pasted the output of > his bitmap_print_buf() into the test. If so, this code tests nothing, > and just enforces current behavior of snprintf. I'm not sure I got what you are telling me. The big line is to test strings that are bigger than 4k. ... > > > +static const char large_list[] __initconst = /* more than 4KB */ > > > + "0,4,8,12,16,20,24,28,32-33,36-37,40-41,44-45,48-49,52-53,56-57,60-61,64,68,72,76,80,84,88,92,96-97,100-101,104-1" > > > + "05,108-109,112-113,116-117,120-121,124-125,128,132,136,140,144,148,152,156,160-161,164-165,168-169,172-173,176-1" > > > + "77,180-181,184-185,188-189,192,196,200,204,208,212,216,220,224-225,228-229,232-233,236-237,240-241,244-245,248-2" > > I don't like this behavior of the code: each individual line is not a > valid bitmap_list. I would prefer to split original bitmap and print > list representation of parts in a compatible format; considering a > receiving part of this splitting machinery. I agree that split is not the best here, but after all it's only 1 line and this is on purpose. -- With Best Regards, Andy Shevchenko