Blame schedattr.patch

Daniel P. Berrangé 9022fd
From qemu-devel-bounces+berrange=redhat.com@nongnu.org Fri Oct 11 20:32:42 2024
Daniel P. Berrangé 9022fd
Delivered-To: berrange@gapps.redhat.com
Daniel P. Berrangé 9022fd
Received: by 2002:a05:612c:fcb:b0:49e:3967:5c with SMTP id kg11csp620284vqb;
Daniel P. Berrangé 9022fd
        Fri, 11 Oct 2024 12:32:43 -0700 (PDT)
Daniel P. Berrangé 9022fd
X-Forwarded-Encrypted: i=2; AJvYcCXPcgyQ0/+OIS7vrT6LX5S6B3Hgz9IoezpGzlHzuQ86lhsSq6u4TrVfGwET6WFesjl4msgGP886/Q==@gapps.redhat.com
Daniel P. Berrangé 9022fd
X-Google-Smtp-Source: AGHT+IGI1MzgaHjMk041SIq3SzZGJRAF05keA8usOtLVfsqz+UnG8gS/7JH2MnqELZrotA/GJ+FI
Daniel P. Berrangé 9022fd
X-Received: by 2002:a05:6870:530c:b0:277:e35a:d2d5 with SMTP id 586e51a60fabf-2886e0d7223mr2593115fac.47.1728675162879;
Daniel P. Berrangé 9022fd
        Fri, 11 Oct 2024 12:32:42 -0700 (PDT)
Daniel P. Berrangé 9022fd
ARC-Seal: i=1; a=rsa-sha256; t=1728675162; cv=none;
Daniel P. Berrangé 9022fd
        d=google.com; s=arc-20240605;
Daniel P. Berrangé 9022fd
        b=alETPlokQysotchMz04b4QkeW4n7IaCvDHuYMZh698k8mF5RJMclj7AfzOWMyGXURw
Daniel P. Berrangé 9022fd
         kFfdMDxoHBlzWY9bTAGsH6EBkFDcJ9RyMs2Oy/exl09b3Zbt/LaW/PgqJZWi7DqZe7FD
Daniel P. Berrangé 9022fd
         Zo3bqW5OSwWxU/vpy6n8B4EV22uFeRNhdTlzj0nbU4h+YpUcUzXR++ssowqa367TMQ5s
Daniel P. Berrangé 9022fd
         THtVdddGT62AlbkeybdC/gTVxTt0RktEBMKTh+MzuZJ1rcgMb+pbG6h/XF5Iub2C+szk
Daniel P. Berrangé 9022fd
         EkyaW96aO1YTzalK4HCCL7cuCauVGvVShSjUfPFMqXRxvzVfFqn02zZh6C4AXb/a/gIT
Daniel P. Berrangé 9022fd
         YiXA==
Daniel P. Berrangé 9022fd
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605;
Daniel P. Berrangé 9022fd
        h=content-transfer-encoding:sender:errors-to:list-subscribe:list-help
Daniel P. Berrangé 9022fd
         :list-post:list-archive:list-unsubscribe:list-id:precedence
Daniel P. Berrangé 9022fd
         :mime-version:message-id:date:subject:cc:to:from:delivered-to;
Daniel P. Berrangé 9022fd
        bh=PO9IbOEY2YqKRkyInUx1mFCEKdNyF6F1Ade1P8ET5cM=;
Daniel P. Berrangé 9022fd
        fh=xgCffyEVvm6hjKwQ8pT/suARWWrEEvCTAvMVKpBgaZg=;
Daniel P. Berrangé 9022fd
        b=Q4fnfvzilypAHQRG6QbhiDXJWTDiP8dnRA4CB3fnXjC3sGRa+4+abHQkdOy6pMW4T9
Daniel P. Berrangé 9022fd
         HhCdtLquJqRIBSQNVEVZMN5bFDX+gIaEA6pmEbd8Sdi47dl2+VS7vP9dQWf/FOtrkGqg
Daniel P. Berrangé 9022fd
         D6K6DlbOdtzmdoTtWcI9Zm1eg6/98cVH2/hqzO/Ig1eI47UvIJpZtm3CMa3y5BgoJhmX
Daniel P. Berrangé 9022fd
         v1pxjLmbVwmOdo8YkXgT3bH5iAPwXjn8FU7q4Z+CX3XChIQksWGvkB+zR/d7xqsEEdTv
Daniel P. Berrangé 9022fd
         x85zJC/K4M9DAnuyJA2rIcrt/QUDHpdAPfcV2gDWr4IBhF27Ul9j6vjXzKNHaGjJxXbF
Daniel P. Berrangé 9022fd
         hFsw==;
Daniel P. Berrangé 9022fd
        dara=google.com
Daniel P. Berrangé 9022fd
ARC-Authentication-Results: i=1; mx.google.com;
Daniel P. Berrangé 9022fd
       spf=pass (google.com: domain of qemu-devel-bounces+berrange=redhat.com@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+berrange=redhat.com@nongnu.org"
Daniel P. Berrangé 9022fd
Return-Path: <qemu-devel-bounces+berrange=redhat.com@nongnu.org>
Daniel P. Berrangé 9022fd
Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com. [205.139.110.120])
Daniel P. Berrangé 9022fd
        by mx.google.com with ESMTPS id af79cd13be357-7b114998ee3si449329885a.281.2024.10.11.12.32.42
Daniel P. Berrangé 9022fd
        for <berrange@gapps.redhat.com>
Daniel P. Berrangé 9022fd
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Daniel P. Berrangé 9022fd
        Fri, 11 Oct 2024 12:32:42 -0700 (PDT)
Daniel P. Berrangé 9022fd
Received-SPF: pass (google.com: domain of qemu-devel-bounces+berrange=redhat.com@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17;
Daniel P. Berrangé 9022fd
Authentication-Results: mx.google.com;
Daniel P. Berrangé 9022fd
       spf=pass (google.com: domain of qemu-devel-bounces+berrange=redhat.com@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+berrange=redhat.com@nongnu.org"
Daniel P. Berrangé 9022fd
Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com
Daniel P. Berrangé 9022fd
 (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by
Daniel P. Berrangé 9022fd
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,
Daniel P. Berrangé 9022fd
 cipher=TLS_AES_256_GCM_SHA384) id us-mta-14-mwcDIPw2Ma-2fc8EyJ2Anw-1; Fri,
Daniel P. Berrangé 9022fd
 11 Oct 2024 15:32:41 -0400
Daniel P. Berrangé 9022fd
X-MC-Unique: mwcDIPw2Ma-2fc8EyJ2Anw-1
Daniel P. Berrangé 9022fd
Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15])
Daniel P. Berrangé 9022fd
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
Daniel P. Berrangé 9022fd
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
Daniel P. Berrangé 9022fd
	(No client certificate requested)
Daniel P. Berrangé 9022fd
	by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A96C819560AE
Daniel P. Berrangé 9022fd
	for <berrange@gapps.redhat.com>; Fri, 11 Oct 2024 19:32:40 +0000 (UTC)
Daniel P. Berrangé 9022fd
Received: by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)
Daniel P. Berrangé 9022fd
	id A3F151956089; Fri, 11 Oct 2024 19:32:40 +0000 (UTC)
Daniel P. Berrangé 9022fd
Delivered-To: berrange@redhat.com
Daniel P. Berrangé 9022fd
Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.23])
Daniel P. Berrangé 9022fd
	by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9EAE41955F42
Daniel P. Berrangé 9022fd
	for <berrange@redhat.com>; Fri, 11 Oct 2024 19:32:40 +0000 (UTC)
Daniel P. Berrangé 9022fd
Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120])
Daniel P. Berrangé 9022fd
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
Daniel P. Berrangé 9022fd
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
Daniel P. Berrangé 9022fd
	(No client certificate requested)
Daniel P. Berrangé 9022fd
	by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A35819560B5
Daniel P. Berrangé 9022fd
	for <berrange@redhat.com>; Fri, 11 Oct 2024 19:32:40 +0000 (UTC)
Daniel P. Berrangé 9022fd
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
Daniel P. Berrangé 9022fd
 relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2,
Daniel P. Berrangé 9022fd
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
Daniel P. Berrangé 9022fd
 us-mta-656-VIioc_tgPx6dfe3wuTFP4A-1; Fri, 11 Oct 2024 15:32:38 -0400
Daniel P. Berrangé 9022fd
X-MC-Unique: VIioc_tgPx6dfe3wuTFP4A-1
Daniel P. Berrangé 9022fd
Received: from localhost ([::1] helo=lists1p.gnu.org)
Daniel P. Berrangé 9022fd
	by lists.gnu.org with esmtp (Exim 4.90_1)
Daniel P. Berrangé 9022fd
	(envelope-from <qemu-devel-bounces@nongnu.org>)
Daniel P. Berrangé 9022fd
	id 1szLMh-00020r-5j; Fri, 11 Oct 2024 15:31:55 -0400
Daniel P. Berrangé 9022fd
Received: from eggs.gnu.org ([2001:470:142:3::10])
Daniel P. Berrangé 9022fd
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
Daniel P. Berrangé 9022fd
 (Exim 4.90_1) (envelope-from <raj.khem@gmail.com>)
Daniel P. Berrangé 9022fd
 id 1szLMb-00020P-1q
Daniel P. Berrangé 9022fd
 for qemu-devel@nongnu.org; Fri, 11 Oct 2024 15:31:51 -0400
Daniel P. Berrangé 9022fd
Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635])
Daniel P. Berrangé 9022fd
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
Daniel P. Berrangé 9022fd
 (Exim 4.90_1) (envelope-from <raj.khem@gmail.com>)
Daniel P. Berrangé 9022fd
 id 1szLMW-0003EY-RE
Daniel P. Berrangé 9022fd
 for qemu-devel@nongnu.org; Fri, 11 Oct 2024 15:31:46 -0400
Daniel P. Berrangé 9022fd
Received: by mail-pl1-x635.google.com with SMTP id
Daniel P. Berrangé 9022fd
 d9443c01a7336-20bb610be6aso25161715ad.1
Daniel P. Berrangé 9022fd
 for <qemu-devel@nongnu.org>; Fri, 11 Oct 2024 12:31:44 -0700 (PDT)
Daniel P. Berrangé 9022fd
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
Daniel P. Berrangé 9022fd
 d=1e100.net; s=20230601; t=1728675103; x=1729279903;
Daniel P. Berrangé 9022fd
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
Daniel P. Berrangé 9022fd
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
Daniel P. Berrangé 9022fd
 :reply-to;
Daniel P. Berrangé 9022fd
 bh=PO9IbOEY2YqKRkyInUx1mFCEKdNyF6F1Ade1P8ET5cM=;
Daniel P. Berrangé 9022fd
 b=K3X31NNuvHdknW5P8UcnhDjhiG8YvVt80acZ9o0cp4OYATGyivVrgqlV16YtlE7nbP
Daniel P. Berrangé 9022fd
 c2GxVasHb4XHOFgQ/OS9twOzcL7BvXjTYuSlqOjY9QQ9Ng38MAMFgLpleBdUdi0JHrfh
Daniel P. Berrangé 9022fd
 vH2pyWqiWlGfPiDmnJWawogp9bgGCHsqyjPUtcw1LCUqNNx0sfyV98mwYq27/2m4POny
Daniel P. Berrangé 9022fd
 BQ0yFM/O7SF2EkZuaQwCJWPmH3fQatSgwEAq5u1SGy/Tn9a9GB4Iyolqgm4mMJBiful/
Daniel P. Berrangé 9022fd
 xoI0a2JEsYatNItIvqoWJ5uBgwrOZHldhxPZGCUP9cL5ecB1flcnPXHxLR4p0/kiQzuI
Daniel P. Berrangé 9022fd
 LzCw==
Daniel P. Berrangé 9022fd
X-Gm-Message-State: AOJu0YxWyAwGwQqYK1sZdfMljusz9BkH4fhylN1UvHETC7GDQDWtfFQS
Daniel P. Berrangé 9022fd
 zz40Z5A7yrfIoS4SkMLM2xTSe57qyfKfFPHRVJe68kPHnsvbdEUpZAecLqJ/
Daniel P. Berrangé 9022fd
X-Received: by 2002:a17:902:d2c5:b0:20c:a644:817f with SMTP id
Daniel P. Berrangé 9022fd
 d9443c01a7336-20ca6448261mr49539675ad.7.1728675103070; 
Daniel P. Berrangé 9022fd
 Fri, 11 Oct 2024 12:31:43 -0700 (PDT)
Daniel P. Berrangé 9022fd
Received: from apollo.hsd1.ca.comcast.net ([2601:646:9d80:4380::f083])
Daniel P. Berrangé 9022fd
 by smtp.gmail.com with ESMTPSA id
Daniel P. Berrangé 9022fd
 d9443c01a7336-20c8bc13551sm26871055ad.88.2024.10.11.12.31.42
Daniel P. Berrangé 9022fd
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Daniel P. Berrangé 9022fd
 Fri, 11 Oct 2024 12:31:42 -0700 (PDT)
Daniel P. Berrangé 9022fd
From: Khem Raj <raj.khem@gmail.com>
Daniel P. Berrangé 9022fd
To: qemu-devel@nongnu.org
Daniel P. Berrangé 9022fd
Cc: Khem Raj <raj.khem@gmail.com>, Laurent Vivier <laurent@vivier.eu>,
Daniel P. Berrangé 9022fd
 Paolo Bonzini <pbonzini@redhat.com>
Daniel P. Berrangé 9022fd
Subject: [PATCH v2] sched_attr: Do not define for glibc >= 2.41
Daniel P. Berrangé 9022fd
Date: Fri, 11 Oct 2024 12:31:40 -0700
Daniel P. Berrangé 9022fd
Message-ID: <20241011193140.1047648-1-raj.khem@gmail.com>
Daniel P. Berrangé 9022fd
MIME-Version: 1.0
Daniel P. Berrangé 9022fd
X-Spam_score_int: -20
Daniel P. Berrangé 9022fd
X-Spam_score: -2.1
Daniel P. Berrangé 9022fd
X-Spam_bar: --
Daniel P. Berrangé 9022fd
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
Daniel P. Berrangé 9022fd
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
Daniel P. Berrangé 9022fd
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
Daniel P. Berrangé 9022fd
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
Daniel P. Berrangé 9022fd
X-Spam_action: no action
Daniel P. Berrangé 9022fd
X-BeenThere: qemu-devel@nongnu.org
Daniel P. Berrangé 9022fd
X-Mailman-Version: 2.1.29
Daniel P. Berrangé 9022fd
Precedence: list
Daniel P. Berrangé 9022fd
List-Id: <qemu-devel.nongnu.org>
Daniel P. Berrangé 9022fd
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
Daniel P. Berrangé 9022fd
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
Daniel P. Berrangé 9022fd
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
Daniel P. Berrangé 9022fd
List-Post: <mailto:qemu-devel@nongnu.org>
Daniel P. Berrangé 9022fd
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
Daniel P. Berrangé 9022fd
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
Daniel P. Berrangé 9022fd
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Daniel P. Berrangé 9022fd
Errors-To: qemu-devel-bounces+berrange=redhat.com@nongnu.org
Daniel P. Berrangé 9022fd
Sender: qemu-devel-bounces+berrange=redhat.com@nongnu.org
Daniel P. Berrangé 9022fd
X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition;Similar Internal Domain=false;Similar Monitored External Domain=false;Custom External Domain=false;Mimecast External Domain=false;Newly Observed Domain=false;Internal User Name=false;Custom Display Name List=false;Reply-to Address Mismatch=false;Targeted Threat Dictionary=false;Mimecast Threat Dictionary=false;Custom Threat Dictionary=false
Daniel P. Berrangé 9022fd
X-Mimecast-Bulk-Signature: yes
Daniel P. Berrangé 9022fd
X-Mimecast-Spam-Signature: bulk
Daniel P. Berrangé 9022fd
X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15
Daniel P. Berrangé 9022fd
X-Mimecast-Spam-Score: 0
Daniel P. Berrangé 9022fd
X-Mimecast-Originator: gmail.com
Daniel P. Berrangé 9022fd
Content-Transfer-Encoding: 8bit
Daniel P. Berrangé 9022fd
Content-Type: text/plain; charset="US-ASCII"; x-default=true
Daniel P. Berrangé 9022fd
Status: RO
Daniel P. Berrangé 9022fd
Content-Length: 1578
Daniel P. Berrangé 9022fd
Lines: 42
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions
Daniel P. Berrangé 9022fd
and struct sched_attr. Therefore, it needs to be checked for here as well before
Daniel P. Berrangé 9022fd
defining sched_attr
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
Fixes builds with glibc/trunk
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Daniel P. Berrangé 9022fd
Cc: Laurent Vivier <laurent@vivier.eu>
Daniel P. Berrangé 9022fd
Cc: Paolo Bonzini <pbonzini@redhat.com>
Daniel P. Berrangé 9022fd
---
Daniel P. Berrangé 9022fd
v2: Use SCHED_ATTR_SIZE_VER0 instead of glibc version check
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
 linux-user/syscall.c | 4 +++-
Daniel P. Berrangé 9022fd
 1 file changed, 3 insertions(+), 1 deletion(-)
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
Daniel P. Berrangé 9022fd
index 1354e75694..caecbb765d 100644
Daniel P. Berrangé 9022fd
--- a/linux-user/syscall.c
Daniel P. Berrangé 9022fd
+++ b/linux-user/syscall.c
Daniel P. Berrangé 9022fd
@@ -359,7 +359,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len,
Daniel P. Berrangé 9022fd
 #define __NR_sys_sched_setaffinity __NR_sched_setaffinity
Daniel P. Berrangé 9022fd
 _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len,
Daniel P. Berrangé 9022fd
           unsigned long *, user_mask_ptr);
Daniel P. Berrangé 9022fd
-/* sched_attr is not defined in glibc */
Daniel P. Berrangé 9022fd
+/* sched_attr is not defined in glibc < 2.41 */
Daniel P. Berrangé 9022fd
+#ifndef SCHED_ATTR_SIZE_VER0
Daniel P. Berrangé 9022fd
 struct sched_attr {
Daniel P. Berrangé 9022fd
     uint32_t size;
Daniel P. Berrangé 9022fd
     uint32_t sched_policy;
Daniel P. Berrangé 9022fd
@@ -372,6 +373,7 @@ struct sched_attr {
Daniel P. Berrangé 9022fd
     uint32_t sched_util_min;
Daniel P. Berrangé 9022fd
     uint32_t sched_util_max;
Daniel P. Berrangé 9022fd
 };
Daniel P. Berrangé 9022fd
+#endif
Daniel P. Berrangé 9022fd
 #define __NR_sys_sched_getattr __NR_sched_getattr
Daniel P. Berrangé 9022fd
 _syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr,
Daniel P. Berrangé 9022fd
           unsigned int, size, unsigned int, flags);
Daniel P. Berrangé 9022fd
Daniel P. Berrangé 9022fd