From patchwork Thu Oct 10 09:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 13829851 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3645A1BCA02 for ; Thu, 10 Oct 2024 09:33:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728552830; cv=none; b=gvquFgrNo9xP1vwEyz6bBHEJHXSGPz1meuYPXi/ezwyMf3k3ZR44XfP25sh/DqSCdljIw/MhECRREVDz0EIJkfbU+w4JbRB5G5M73E3vBRUGvNur3VjkCcB48uMX73YkSCTaj1vg/ETLRcWGrBudpW7jTxwOE6YOxHi5UA4MzKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728552830; c=relaxed/simple; bh=fkXobUdfWdyEcyBYXYsJwrld/0fHQc7RFH181BVrf/o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-type; b=mtWmCLTy0WcbSlRNM4Hf0+fh8+N6mcNOZ75Um2rKx4qNkr8Hv3qkDYXfD99UvBRiftiZdNeZqSuxwFfhLNY75qgj/8VcXjfc7iKW+XlLH63CaYk+WwccoVSPFwR3UW+QV5hCTVpoR9w4pIIacEmhJsGZ6Ox5MGAEYITJRU5Rthw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MsHuEVEf; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MsHuEVEf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728552827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=huflEMTO5aCsGTjWE8teWJNUWw4AKygAw9ZhX1UXaaM=; b=MsHuEVEfnu3wq2DxKJ1pVtfvrN0vmQO6sy7It5sAAbpO7hhWjjWa51hcMj10VbwUjueKyD z2gGrxSurj2E9tAvYyktXf4owW2keV751lMPFQZWCS6Hjh2lDRF21J3CjaDtzsULOdgjS/ s8bdFRXqATZO5V+O0TD/T5MWnMWlLx8= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-475-dzgoB4H1P4SZqz8QQuKnMQ-1; Thu, 10 Oct 2024 05:33:44 -0400 X-MC-Unique: dzgoB4H1P4SZqz8QQuKnMQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 18A2D195608C; Thu, 10 Oct 2024 09:33:43 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.226.2]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A9C3E300019E; Thu, 10 Oct 2024 09:33:40 +0000 (UTC) From: Jan Stancek To: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jstancek@redhat.com, jforbes@redhat.com, ezulian@redhat.com, tglozar@redhat.com Subject: [PATCH 1/2] tools/rtla: drop __NR_sched_getattr Date: Thu, 10 Oct 2024 11:32:58 +0200 Message-ID: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 It's not used since commit 084ce16df0f0 ("tools/rtla: Remove unused sched_getattr() function"). Signed-off-by: Jan Stancek Reviewed-by: Tomas Glozar --- tools/tracing/rtla/src/utils.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 9ac71a66840c..05b2b3fc005e 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -211,24 +211,20 @@ long parse_ns_duration(char *val) /* * This is a set of helper functions to use SCHED_DEADLINE. */ -#ifdef __x86_64__ -# define __NR_sched_setattr 314 -# define __NR_sched_getattr 315 -#elif __i386__ -# define __NR_sched_setattr 351 -# define __NR_sched_getattr 352 -#elif __arm__ -# define __NR_sched_setattr 380 -# define __NR_sched_getattr 381 -#elif __aarch64__ || __riscv -# define __NR_sched_setattr 274 -# define __NR_sched_getattr 275 -#elif __powerpc__ -# define __NR_sched_setattr 355 -# define __NR_sched_getattr 356 -#elif __s390x__ -# define __NR_sched_setattr 345 -# define __NR_sched_getattr 346 +#ifndef __NR_sched_setattr +# ifdef __x86_64__ +# define __NR_sched_setattr 314 +# elif __i386__ +# define __NR_sched_setattr 351 +# elif __arm__ +# define __NR_sched_setattr 380 +# elif __aarch64__ || __riscv +# define __NR_sched_setattr 274 +# elif __powerpc__ +# define __NR_sched_setattr 355 +# elif __s390x__ +# define __NR_sched_setattr 345 +# endif #endif #define SCHED_DEADLINE 6 From patchwork Thu Oct 10 09:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 13829852 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF4B41BE250 for ; Thu, 10 Oct 2024 09:33:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728552836; cv=none; b=GSdHtCgAxu4uvKkLFQCRj66TTNzphHvt4uJ1Pv6BzZ7FRnS8D7x0pEVmmzkLqad6oBJ+XB4Shjyj3yWgZ2X/XYPC/uRxfovsHmTt37ONaeDUQEush7BVquKaU9MAjO7WKYJWprZjyWOBaGo1kzOPGx73ES8qa8zunUgUr1ZqnPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728552836; c=relaxed/simple; bh=UnKplElgkxqXlmdKt21RNbV4im801BH8jlMalCnJrxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OZhx4BZr9v8gqyriHLqDv9vT/8Y25ddGJuDarHc+XHMc3rUt024r/E8+B3kn69RnksvqSwWR9vJ5K1FqXvgpmnB9xNTqhpX+Z7pItv0wEj4P+FbogBxO1NZwUlk5CgAz/ie5DDqYqOLsECt030q2OVaIB4Z9kYOBxGG85lGdja8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JPfhXDYs; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JPfhXDYs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728552832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aVO3JGIa+LyNmHTe4s/0+9qfkW4GP8M1slNLwf55zUI=; b=JPfhXDYs8PrEkwA8K9RcD32+JU8kwBN58XZgrRg6q56z6puCLgQlk9+wt6TNlpoX8Orise ebFH2XAsqspq6yCzjFA4gtBC+sdfyESATQJic6xSXOPQSkvICLpOAnhrsEKs4cIi8PolHm NFGxkObMOVKcWY+ZCiPxfCae/zT156Y= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-hBCnLCXEPEKvoqMSB-UK8Q-1; Thu, 10 Oct 2024 05:33:49 -0400 X-MC-Unique: hBCnLCXEPEKvoqMSB-UK8Q-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 646F81955F10; Thu, 10 Oct 2024 09:33:48 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.226.2]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2D8CB30001A2; Thu, 10 Oct 2024 09:33:45 +0000 (UTC) From: Jan Stancek To: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jstancek@redhat.com, jforbes@redhat.com, ezulian@redhat.com, tglozar@redhat.com Subject: [PATCH 2/2] tools/rtla: fix collision with glibc sched_attr/sched_set_attr Date: Thu, 10 Oct 2024 11:32:59 +0200 Message-ID: <45c1f78d4f0e7f1b786443ffdd462d7670ec1634.1728552769.git.jstancek@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 glibc commit 21571ca0d703 ("Linux: Add the sched_setattr and sched_getattr functions") now also provides 'struct sched_attr' and sched_setattr() which collide with the ones from rtla. In file included from src/trace.c:11: src/utils.h:49:8: error: redefinition of ‘struct sched_attr’ 49 | struct sched_attr { | ^~~~~~~~~~ In file included from /usr/include/bits/sched.h:60, from /usr/include/sched.h:43, from /usr/include/tracefs/tracefs.h:10, from src/trace.c:4: /usr/include/linux/sched/types.h:98:8: note: originally defined here 98 | struct sched_attr { | ^~~~~~~~~~ Define 'struct sched_attr' conditionally, similar to what strace did: https://lore.kernel.org/all/20240930222913.3981407-1-raj.khem@gmail.com/ and rename rtla's version of sched_setattr() to avoid collision. Signed-off-by: Jan Stancek --- tools/tracing/rtla/src/utils.c | 4 ++-- tools/tracing/rtla/src/utils.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 05b2b3fc005e..c62044215a48 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -229,7 +229,7 @@ long parse_ns_duration(char *val) #define SCHED_DEADLINE 6 -static inline int sched_setattr(pid_t pid, const struct sched_attr *attr, +static inline int rtla_sched_setattr(pid_t pid, const struct sched_attr *attr, unsigned int flags) { return syscall(__NR_sched_setattr, pid, attr, flags); } @@ -239,7 +239,7 @@ int __set_sched_attr(int pid, struct sched_attr *attr) int flags = 0; int retval; - retval = sched_setattr(pid, attr, flags); + retval = rtla_sched_setattr(pid, attr, flags); if (retval < 0) { err_msg("Failed to set sched attributes to the pid %d: %s\n", pid, strerror(errno)); diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h index d44513e6c66a..99c9cf81bcd0 100644 --- a/tools/tracing/rtla/src/utils.h +++ b/tools/tracing/rtla/src/utils.h @@ -46,6 +46,7 @@ update_sum(unsigned long long *a, unsigned long long *b) *a += *b; } +#ifndef SCHED_ATTR_SIZE_VER0 struct sched_attr { uint32_t size; uint32_t sched_policy; @@ -56,6 +57,7 @@ struct sched_attr { uint64_t sched_deadline; uint64_t sched_period; }; +#endif /* SCHED_ATTR_SIZE_VER0 */ int parse_prio(char *arg, struct sched_attr *sched_param); int parse_cpu_set(char *cpu_list, cpu_set_t *set);