From nobody Sat Nov 13 12:23:20 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8B2771848780 for ; Sat, 13 Nov 2021 12:23:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hrvkk1hTMz4Wbg; Sat, 13 Nov 2021 12:23:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 1ADCNKcX072704 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 13 Nov 2021 14:23:23 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 1ADCNKcX072704 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 1ADCNKk4072703; Sat, 13 Nov 2021 14:23:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 13 Nov 2021 14:23:20 +0200 From: Konstantin Belousov To: Gerald Pfeifer Cc: Yasuhiro Kimura , freebsd-current@freebsd.org, kde@freebsd.org, Damjan Jovanovic Subject: Re: Build of devel/ninja and lang/gcc11 fails with latest 14-CURRENT amd64 Message-ID: References: <20211113.053153.925491349721631675.yasu@FreeBSD.org> <76e4f589-2df5-8f6f-ac9d-403020f8587b@pfeifer.com> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76e4f589-2df5-8f6f-ac9d-403020f8587b@pfeifer.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4Hrvkk1hTMz4Wbg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N On Sat, Nov 13, 2021 at 09:54:47AM +0100, Gerald Pfeifer wrote: > On Sat, 13 Nov 2021, Konstantin Belousov wrote: > >> ---------------------------------------------------------------------- > >> commit 160b4b922b6 > >> Author: Konstantin Belousov > >> Date: Sat Oct 23 00:17:21 2021 > >> > >> Add real sched.h > >> > >> It is required by IEEE Std 1003.1-2008 AKA POSIX. > >> > >> Put some Linux compatibility stuff under BSD_VISIBLE namespace, in > >> particular, sys/cpuset.h definitions. Also, if user really want > >> Linux compatibility, she can request cpu_set_t typedef with > >> _WITH_CPU_SET_T define. > >> > >> Reviewed by: jhb > >> Sponsored by: The FreeBSD Foundation > >> MFC after: 1 week > >> Differential revision: https://reviews.freebsd.org/D32901 > >> ---------------------------------------------------------------------- > >> > >> It seems likely this is the cause of build error. > > Ninja builds with the following patch, other failing ports have a chance > > as well. > > > > commit 1acaa4bb838c074c29926cb34b7827efb26cdc85 > > Author: Konstantin Belousov > > Date: Thu Nov 11 10:01:54 2021 +0200 > > > > sched.h: Make cpu_set_t compat typedef visible unconditionally > > > > or rather, visible if BSD namespace is enabled, instead of requiring > > _WITH_CPU_SET_T define to expose it. It seems a lot of code assumes > > that presence of sched_getaffinity() implies existence of cpu_set_t. > > > > Reported by: portmgr (antoine) > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > > > diff --git a/include/sched.h b/include/sched.h > > index 1c41cda79046..2d4f301c9718 100644 > > --- a/include/sched.h > > +++ b/include/sched.h > > @@ -34,13 +34,8 @@ > > #include > > #if __BSD_VISIBLE > > #include > > -#endif /* __BSD_VISIBLE */ > > - > > -#if __BSD_VISIBLE > > -#ifdef _WITH_CPU_SET_T > > struct _cpuset; > > typedef struct _cpuset cpu_set_t; > > -#endif /* _WITH_CPU_SET_T */ > > #endif /* __BSD_VISIBLE */ > > > > __BEGIN_DECLS > > I also got a build notification for emulators/wine and believe > emulators/wine-devel is impacted as well. > > The code in question looks as follows, and it seems your follow > up patch should address this? > > int set_thread_affinity( struct thread *thread, affinity_t affinity ) > { > int ret = 0; > #ifdef HAVE_SCHED_SETAFFINITY > if (thread->unix_tid != -1) > { > cpu_set_t set; > int i; > affinity_t mask; > > CPU_ZERO( &set ); > for (i = 0, mask = 1; mask; i++, mask <<= 1) > if (affinity & mask) CPU_SET( i, &set ); > > ret = sched_setaffinity( thread->unix_tid, sizeof(set), &set ); > } > #endif > > If so, it looks like your work unleashes enhanced functionality on > FreeBSD! Nice. > > Original notification message below. I have to hide these features under opt-in feature macro test. You would need to pass -D_WITH_CPU_SET_T to compiler, both at the configure and build stage, to get to the functionality. But for wine it seems yes, what I added should be enough to get thread affinity features working.