Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2018 00:42:28 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Warner Losh <imp@bsdimp.com>, Konstantin Belousov <kostikbel@gmail.com>,  src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r340676 - in head/sys: kern sys
Message-ID:  <CAGudoHGgRBz60S6dEOgprY7Aohk55%2B5sSivw7bKfA_F_E-zpZA@mail.gmail.com>
In-Reply-To: <8cae923a-2b14-c16b-23e7-e6eb7e9a8c3a@FreeBSD.org>
References:  <201811201458.wAKEwftP033152@repo.freebsd.org> <20181120150756.GD2378@kib.kiev.ua> <CAGudoHG-8VpSpTMX=ZL4LhSsfUe9fEkjr_-KE83K1NQGsskihw@mail.gmail.com> <CANCZdfrDyj1qjkp1XGjYP_bCHJfmcdbHxUQ%2BncNE=quQfOabUw@mail.gmail.com> <CAGudoHFL-B6e5oufAKMY=_gvgto1o07DPHxfv3rZGnaiEwB9yg@mail.gmail.com> <8cae923a-2b14-c16b-23e7-e6eb7e9a8c3a@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/26/18, John Baldwin <jhb@freebsd.org> wrote:
> On 11/22/18 9:28 AM, Mateusz Guzik wrote:
>> diff --git a/sys/sys/systm.h b/sys/sys/systm.h
>> index a1b98c5660c..fab94ee7979 100644
>> --- a/sys/sys/systm.h
>> +++ b/sys/sys/systm.h
>> @@ -523,7 +523,11 @@ int alloc_unr_specific(struct unrhdr *uh, u_int
>> item);
>>  int alloc_unrl(struct unrhdr *uh);
>>  void free_unr(struct unrhdr *uh, u_int item);
>>
>> -#if defined(__mips__) || defined(__powerpc__)
>> +#if defined(mips) && !defined(__mips_n64) && !defined(__mips_n32)
>> +#define UNR64_LOCKED
>> +#endif
>
> This would perhaps be shorter as:
>
> #if defined(__mips__) && defined(__mips_o32)
>
>> +
>> +#if defined(__powerpc__) && !defined(__powerpc64__)
>>  #define UNR64_LOCKED
>>  #endif
>
> It's not clear to me why this isn't just conditional on LP64 though.
> If 32-bit riscv existed in FreeBSD it would also not have this.  If we
> really care that much about i386 and 32-bit arm you could write it as:
>
> #if !(defined(__LP64__) || defined(__i386__) || defined(__arm__))
>
> (I'm not sure we care that much though and think we could just use __LP64__
> alone and call it a day.)
>

There will be future optimizations which would be defeated for platforms
resorting to the lock, but playing around it may not be worth it.

That said, if noone objects I'll just __LP64__ as suggested:

diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index a1b98c5660c..b250c54033c 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -523,7 +523,7 @@ int alloc_unr_specific(struct unrhdr *uh, u_int item);
 int alloc_unrl(struct unrhdr *uh);
 void free_unr(struct unrhdr *uh, u_int item);

-#if defined(__mips__) || defined(__powerpc__)
+#ifndef __LP64__
 #define UNR64_LOCKED
 #endif

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHGgRBz60S6dEOgprY7Aohk55%2B5sSivw7bKfA_F_E-zpZA>