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 01478C433EF for ; Mon, 29 Nov 2021 14:26:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5AE996B0088; Mon, 29 Nov 2021 09:23:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55E896B0089; Mon, 29 Nov 2021 09:23:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D8D86B008A; Mon, 29 Nov 2021 09:23:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 304846B0088 for ; Mon, 29 Nov 2021 09:23:10 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E98A2184D7FA3 for ; Mon, 29 Nov 2021 14:22:59 +0000 (UTC) X-FDA: 78862184478.30.7687B99 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf28.hostedemail.com (Postfix) with ESMTP id C95A8900033A for ; Mon, 29 Nov 2021 14:22:00 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1ATDlFr0028332; Mon, 29 Nov 2021 14:21:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : references : date : in-reply-to : message-id : mime-version : content-type; s=pp1; bh=SDxQU0Cf2tzKKlX7o2UXE1teEX8a7e551zSq540YKLk=; b=d+crWRJPa5r57bLvIQzzuevNedkyG3+niNSYWU9Swfp2n///dxmoX+dZO+LB4CVZ71bN 5c5IcI4VvQFzEWHfWhl38qeOnM5aj4PT5wNRBfAgpyJhpvI1siJ/TTn+/uLBq2W73OKO aFazRIgZeoxM30M3r+yoWawVO9Gi8zKqhTdtc9k8IatSEcmSOh5NxInE6bp/mr45vUHJ 7EVLWfbOz8YunoJmYa4BvTgth4e8v/lscPHGWM7ZFlhU1SZfK+/at1qyct0ZiAT/eBKX 3lJGXQjMoKTdMbVS1FchE7/jju5VIOxLwa5smjQAZhS1sVAj9hfPoOr5iqSnxgQsJRne JA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cn026rxka-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 14:21:30 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1ATDllAl029213; Mon, 29 Nov 2021 14:21:30 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cn026rxhx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 14:21:30 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1ATEDKn4001853; Mon, 29 Nov 2021 14:21:27 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma05fra.de.ibm.com with ESMTP id 3ckca94tnx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 14:21:27 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1ATELODV11272478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Nov 2021 14:21:25 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7476AE04D; Mon, 29 Nov 2021 14:21:24 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C90AAE072; Mon, 29 Nov 2021 14:21:24 +0000 (GMT) Received: from tuxmaker.linux.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 29 Nov 2021 14:21:24 +0000 (GMT) From: Sven Schnelle To: Yafang Shao Cc: Andrew Morton , netdev , bpf , "linux-perf-use." , linux-fsdevel@vger.kernel.org, Linux MM , LKML , kernel test robot , kbuild test robot , Andrii Nakryiko , David Hildenbrand , Mathieu Desnoyers , Arnaldo Carvalho de Melo , Andrii Nakryiko , Michal Miroslaw , Peter Zijlstra , Steven Rostedt , Matthew Wilcox , Al Viro , Kees Cook , Petr Mladek Subject: Re: [PATCH v2 7/7] tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN References: <20211120112738.45980-1-laoar.shao@gmail.com> <20211120112738.45980-8-laoar.shao@gmail.com> Date: Mon, 29 Nov 2021 15:21:23 +0100 In-Reply-To: (Yafang Shao's message of "Mon, 29 Nov 2021 21:41:11 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7Xp9iYRAqWlAkU7aNJskL8ZvHI5hqD4L X-Proofpoint-ORIG-GUID: 4I5asdX1Ck6krCqWTqdjTyeMLwa83xva X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-29_08,2021-11-28_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 adultscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111290071 X-Rspamd-Queue-Id: C95A8900033A X-Stat-Signature: uu1ow8jah36nbgmq8uj6gup1bpo6c9co Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=d+crWRJP; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf28.hostedemail.com: domain of svens@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=svens@linux.ibm.com X-Rspamd-Server: rspam02 X-HE-Tag: 1638195720-970690 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: Hi, Yafang Shao writes: > On Mon, Nov 29, 2021 at 6:13 PM Sven Schnelle wrote: >> > diff --git a/include/linux/sched.h b/include/linux/sched.h >> > index 78c351e35fec..cecd4806edc6 100644 >> > --- a/include/linux/sched.h >> > +++ b/include/linux/sched.h >> > @@ -274,8 +274,13 @@ struct task_group; >> > >> > #define get_current_state() READ_ONCE(current->__state) >> > >> > -/* Task command name length: */ >> > -#define TASK_COMM_LEN 16 >> > +/* >> > + * Define the task command name length as enum, then it can be visible to >> > + * BPF programs. >> > + */ >> > +enum { >> > + TASK_COMM_LEN = 16, >> > +}; >> >> This breaks the trigger-field-variable-support.tc from the ftrace test >> suite at least on s390: >> >> echo >> 'hist:keys=next_comm:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) >> if next_comm=="ping"' >> linux/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc: line 15: echo: write error: Invalid argument >> >> I added a debugging line into check_synth_field(): >> >> [ 44.091037] field->size 16, hist_field->size 16, field->is_signed 1, hist_field->is_signed 0 >> >> Note the difference in the signed field. >> > > Hi Sven, > > 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. Regards Sven