Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15988232rwd; Mon, 26 Jun 2023 04:22:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/6UvsP0k9uMzTbff8Vl2xp4lWxla0q/epyP3Lz72Lx00Rd/0sXwm1I6M06dQtiew97O7P X-Received: by 2002:a05:6808:1a26:b0:3a1:e84f:161b with SMTP id bk38-20020a0568081a2600b003a1e84f161bmr1014565oib.43.1687778522585; Mon, 26 Jun 2023 04:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687778522; cv=none; d=google.com; s=arc-20160816; b=FO6NPdWxCQv9Bfn7puVZ/oDLZczusCgx+oZe1PcWKcecIOC4HYYNLmOi1GStK/4Ich CxN0UwOkro6u9V2X8btTqBSzHxLaSntvle03Scyh9HL+sETf/zOyDyc4rnvZly27Ra2T IZgDvLC7jPfDjZr/QukVXHBETPp8JlPzGFWMSOkofeu4kc7N3AAE1XglOJ03YV4VzXCU xHb5eHrX7cXD1VtcfI2A01n8mBTpq6I4kOxh4L10aZ5rXGbbK1TWlsd8yAt+cb9Odn1S sRkQSdJDa6TE7RRATQk82XvGTNmJcXDmlj/nR8gxHIE2zlb2vihV+kn4ZLeCX4lHmr4y rwkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=DzHCjDmFdPWkZDLIQrmafKhZdhqELJ4XHh1P4vCcmtQ=; fh=fWeR3Cyc3YyYNs7QKUEMT2DHrSYPMMFNc3lU0W0YDWw=; b=MA8Ycm5/W7kXu1DiCF1CLGRzHeit6onwzakXW83QL0xowpCODPS9vRgADbTG/lsLs6 rqRCpwclZrhlkxi/hR1790fyJW6kIQHVxvYHAjrsKPMt+OrwxZbx2cXk+YEw8eUlbn9i LvI8jPi0y1lLR++1V1QNLDOc4aBdjMRIlJkxPcm7oCdzvTeFJp9+rGocdJCtmfGzuqFP q7XtY+m/RkHMa+E/HHXD8208mBDG4/0rbfx+kdJGU6I9GEICDFwEo+anzG7+4DhQjQQk 4t+aqUHn15jEmPQDcNRxuSp4Sfd+El/lkZvmrXxnz2+fyi341P7KqA5RYtLWThWxbdyk bVtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a17090a9bc600b00262ec69bd80si2230226pjw.72.2023.06.26.04.21.51; Mon, 26 Jun 2023 04:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbjFZLOH (ORCPT + 99 others); Mon, 26 Jun 2023 07:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbjFZLN7 (ORCPT ); Mon, 26 Jun 2023 07:13:59 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BC510D; Mon, 26 Jun 2023 04:13:56 -0700 (PDT) X-UUID: 9f50b0d02be14173b8e22440a5e5c13c-20230626 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:dcaf8dd7-589b-4ef9-b48e-d0d8deb021eb,IP:10, URL:0,TC:0,Content:-20,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:-15 X-CID-INFO: VERSION:1.1.25,REQID:dcaf8dd7-589b-4ef9-b48e-d0d8deb021eb,IP:10,UR L:0,TC:0,Content:-20,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-15 X-CID-META: VersionHash:d5b0ae3,CLOUDID:b5c8803f-de1e-4348-bc35-c96f92f1dcbb,B ulkID:230626191346S428MXED,BulkQuantity:0,Recheck:0,SF:19|43|38|23|17|102, TC:nil,Content:1,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 9f50b0d02be14173b8e22440a5e5c13c-20230626 X-User: sunliming@kylinos.cn Received: from localhost.localdomain [(116.232.67.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1873551291; Mon, 26 Jun 2023 19:13:46 +0800 From: sunliming To: rostedt@goodmis.org, beaub@linux.microsoft.com, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, sunliming Subject: [PATCH v4 0/3] tracing/user_events: Fix incorrect return value for writes when events are disabled and add its tests Date: Mon, 26 Jun 2023 19:13:41 +0800 Message-Id: <20230626111344.19136-1-sunliming@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now the writing operation return the count of writes regardless of whether events are enabled or disabled. Fix this by just return -EBADF when events are disabled. v3 -> v4: - Change the return value from zero to -EBADF v2 -> v3: - Change the return value from -ENOENT to zero v1 -> v2: - Change the return value from -EFAULT to -ENOENT sunliming (3): tracing/user_events: Fix incorrect return value for writing operation when events are disabled selftests/user_events: Enable the event before write_fault test in ftrace self-test selftests/user_events: Add test cases when event is disabled kernel/trace/trace_events_user.c | 3 ++- tools/testing/selftests/user_events/ftrace_test.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) -- 2.25.1