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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1ECBC433F5 for ; Mon, 29 Nov 2021 15:37:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A7CE6B0072; Mon, 29 Nov 2021 10:37:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 530596B0073; Mon, 29 Nov 2021 10:37:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AAB76B0074; Mon, 29 Nov 2021 10:37:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay026.a.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 2A2E86B0072 for ; Mon, 29 Nov 2021 10:37:40 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D711F2063B for ; Mon, 29 Nov 2021 15:37:29 +0000 (UTC) X-FDA: 78862372050.01.C22BB80 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by imf01.hostedemail.com (Postfix) with ESMTP id 9DB12509DA9D for ; Mon, 29 Nov 2021 15:34:03 +0000 (UTC) Received: by mail-qt1-f171.google.com with SMTP id z9so16921766qtj.9 for ; Mon, 29 Nov 2021 07:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i2T0GkM465CLxYnAqMF+b7YZ0kWc7n3IIcbwmTM7QP0=; b=JXT5WXVCBDK3FzsXJSa2uYqiM0WoLQ1yXMA/RTOMlcdVpf3e/OPd8C/CCt5TixBK90 Twpp5j7greFWY25lXiq0ABaJS7HcZOhv/37gZTiXiPkA8jg3mu7eagL/cnE5B4wSd28t zZ6E+9gBUbtiRJ7f2pNDi/1JmPqd3WyGLP1j4uy8r8gcXUhy0v+ZPattDspCONYnwxiB lDpReN7hfI8A0hFZxNPzS8QMhzmm8u0cLGAWJHBNBjL1KgWIW7a8tj1p6mfJSmcFMV7p 2V4fDn5aWsH3gq1qbaR+2pwFiSJRo7UuL4dHXKOIWe5rnRN+nssX014EEvE2R18fjHSA 3Qhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i2T0GkM465CLxYnAqMF+b7YZ0kWc7n3IIcbwmTM7QP0=; b=SMWZFFrnHwUIp5oMVIonHbFrfeBNgAp7zygzRtBjLxd4J54fMUq8gPdzVsai0RzALf zv02Zno7Zrit0HimFVO1zxcRndfyC/FptqHl6ZSD95DyqyF2LAiI5PVWcAt8W3a7qJt4 7dPBGLxMiTZDw/kIwixw+mEVwuFkMxjkqZTk+OwwXm1odR0t9iT5PN+xSBTVdrIEXeoA MwGEqrWWHp3o9SIl6aX2w77r9xmenOXhqCNLEJmee1XTbhI54lmfw9/+MBzoI4t8xpWn 77YZKno6l8snHjoMP6SX3eNBZlXHNc2zORyjKqmZ8CFpmW7cWFI3eCivYL0M/pYxvhbf iuew== X-Gm-Message-State: AOAM533rGqJHERLfEELy8sw59+4JpZkx/BQLORlVzudMluyF5Pn/rdgB j0KUOYzaOJ7b67jF1LpQ/QM3/VQTpEQVeVVXe6g= X-Google-Smtp-Source: ABdhPJyHn4eG/30zIiucx98a7erajhlmeiAoN+4npcSorK0RgbdUp5LB/Hp+l7vrKFjb+udNnVxvVv+qLnsbv+JY+X0= X-Received: by 2002:ac8:7e83:: with SMTP id w3mr45092512qtj.160.1638200049519; Mon, 29 Nov 2021 07:34:09 -0800 (PST) MIME-Version: 1.0 References: <20211120112738.45980-1-laoar.shao@gmail.com> <20211120112738.45980-8-laoar.shao@gmail.com> <54e1b56c-e424-a4b3-4d61-3018aa095f36@redhat.com> In-Reply-To: From: Yafang Shao Date: Mon, 29 Nov 2021 23:33:33 +0800 Message-ID: Subject: Re: [PATCH v2 7/7] tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN To: Sven Schnelle Cc: David Hildenbrand , Andrew Morton , netdev , bpf , "linux-perf-use." , linux-fsdevel@vger.kernel.org, Linux MM , LKML , kernel test robot , kbuild test robot , Andrii Nakryiko , Mathieu Desnoyers , Arnaldo Carvalho de Melo , Andrii Nakryiko , Michal Miroslaw , Peter Zijlstra , Steven Rostedt , Matthew Wilcox , Al Viro , Kees Cook , Petr Mladek Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9DB12509DA9D X-Stat-Signature: a5x4tn13xkury8tc9y6k61adyu1b8iz5 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JXT5WXVC; spf=pass (imf01.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1638200043-518952 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 29, 2021 at 10:38 PM Sven Schnelle wrote: > > Hi, > > David Hildenbrand writes: > > On 29.11.21 15:21, Sven Schnelle wrote: > >> Yafang Shao writes: > >>> Thanks for the report and debugging! > >>> Seems we should explicitly define it as signed ? > >>> Could you pls. help verify it? > >>> > >>> diff --git a/include/linux/sched.h b/include/linux/sched.h > >>> index cecd4806edc6..44d36c6af3e1 100644 > >>> --- a/include/linux/sched.h > >>> +++ b/include/linux/sched.h > >>> @@ -278,7 +278,7 @@ struct task_group; > >>> * Define the task command name length as enum, then it can be visible to > >>> * BPF programs. > >>> */ > >>> -enum { > >>> +enum SignedEnum { > >>> TASK_COMM_LEN = 16, > >>> }; > >> > >> Umm no. What you're doing here is to define the name of the enum as > >> 'SignedEnum'. This doesn't change the type. I think before C++0x you > >> couldn't force an enum type. > > > > I think there are only some "hacks" to modify the type with GCC. For > > example, with "__attribute__((packed))" we can instruct GCC to use the > > smallest type possible for the defined enum values. > > Yes, i meant no way that the standard defines. You could force it to > signed by having a negative member. > > > I think with some fake entries one can eventually instruct GCC to use an > > unsigned type in some cases: > > > > https://stackoverflow.com/questions/14635833/is-there-a-way-to-make-an-enum-unsigned-in-the-c90-standard-misra-c-2004-compl > > > > enum { > > TASK_COMM_LEN = 16, > > TASK_FORCE_UNSIGNED = 0x80000000, > > }; > > > > Haven't tested it, though, and I'm not sure if we should really do that > > ... :) > > TBH, i would vote for reverting the change. defining an array size as > enum feels really odd. > We changed it to enum because the BTF can't parse macro while it can parse the enum type. Anyway I don't insist on keeping this change if you think reverting it is better. Andrew, would you pls. help drop this patch from the -mm tree (the other 6 patches in this series can be kept) ? -- Thanks Yafang