From owner-svn-src-head@freebsd.org Thu Nov 22 17:42:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0029811022FC for ; Thu, 22 Nov 2018 17:42:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it1-x12a.google.com (mail-it1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 319277EAA0 for ; Thu, 22 Nov 2018 17:42:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it1-x12a.google.com with SMTP id h65so14820928ith.3 for ; Thu, 22 Nov 2018 09:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F9TdPOedxco+Cf6ygcxyxsJI+rHiqW8tRV6IC/Xvo9Y=; b=1KLPK3a7+nyrCGyN93vL1jkj3CTAqPnRhX3HplnaPLG6RRH9K9fO9BuxsALuBCWFg5 TQoXfsmXg9FRfRrg8jLmKvNjLnbL9kDDBYSc7K5nv8OXa6tWDp0Z9BBx2CCtIYy73DR5 ozjcunTx6TnB39MBDn6ZptrAZm7X3jZYrXd4Q96quw7rjXNqz42qNRtM2GPYZpR1HTFG 4eCAx+c0AUiCPUB6QOXAmELF44ertLaJ6F/6/uIBmOxZ0W8Zl9JEjoCWFtZjjUwsT/6t buVNrtyNNFEmfON+EiZ4Ky8NWAquwGo6ISulUnThHLmW92ycLc98oEojbQ8XB6IV2knP yaOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=F9TdPOedxco+Cf6ygcxyxsJI+rHiqW8tRV6IC/Xvo9Y=; b=PWFQBLbev18NxZ0PAZztjIfCjyWOu12LPNaaNCNgUADPbbFg6D/o0CZ1tNNGviXFyc ghLAwCLxnHWglf8W8UiSFIkQkiHRaiqKILSBc19zKLjUFpXaUj2lfD5SsnytRPu8orwC K6N8hmPx0kBI2PgW4iJRjfvYIXi10fOmbHajMgMEv9S7wRSsa2PhJrQMDS3VK0IzzX21 1H0aSKqYcfbptf+CtS41alIL13PFX0dNh6IMOlvCHOKnxxVxaoUxsFrynksfm8Xvc/Xn fEC3Cvb/JRi4NDuQhr1s03UEO63J6CzwXvVAwAXhMRp77mqInKn7gHEqnpWG0YeOilXL 3OVg== X-Gm-Message-State: AGRZ1gIC62YLXM922/8tllweg++V1paoyRBPCqSrL3PkMODAk4i0dQly kin/ADB91/JFcohbr5aDXIu8Y0zqGlN1rKjsExOQjQ== X-Google-Smtp-Source: AJdET5dBIGUb3Y3BF50eEIw2FaIWv4RtnY1hUDoKTb0KECr/Eip4iIWlFNhCN19ahvRWcNuKGQsnjdr9ZcMylU+GA3g= X-Received: by 2002:a24:3796:: with SMTP id r144-v6mr10151975itr.79.1542908545237; Thu, 22 Nov 2018 09:42:25 -0800 (PST) MIME-Version: 1.0 References: <201811201458.wAKEwftP033152@repo.freebsd.org> <20181120150756.GD2378@kib.kiev.ua> In-Reply-To: From: Warner Losh Date: Thu, 22 Nov 2018 10:42:14 -0700 Message-ID: Subject: Re: svn commit: r340676 - in head/sys: kern sys To: Mateusz Guzik Cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 319277EAA0 X-Spamd-Result: default: False [-4.65 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[a.2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-1.66)[ip: (-4.62), ipnet: 2607:f8b0::/32(-2.10), asn: 15169(-1.51), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_CC(0.00)[gmail.com] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2018 17:42:27 -0000 On Thu, Nov 22, 2018 at 10:28 AM Mateusz Guzik wrote: > On 11/20/18, Warner Losh wrote: > > On Tue, Nov 20, 2018 at 8:28 AM Mateusz Guzik wrote: > > > >> On 11/20/18, Konstantin Belousov wrote: > >> >> +#if defined(__mips__) || defined(__powerpc__) > >> > Please note what I asked about this #ifdefs in the review. mips > >> > and powerpc machine/atomic.h should define some symbol like > >> > __ATOMIC_NO_64_OPS and this case should be handled in less > >> > arch-explicit > >> > manner. > >> > > >> > >> Right, should have mentioned that in the commit message. > >> > >> Anyhow, mips has some degree of 64 bit ops even for 32 bits so > >> this becomes more iffy. In particular it does have atomic_add_64. > >> I don't have a good way to test mips atomics and since non-atomic > >> version for powerpc was needed anyway I decided not to try to > >> add one. > >> > > > > I thought the 64-bit stuff was not present in true 32-bit mips at all. > You > > need the lld/scd instructions to do 64-bit atomics which are only > available > > in a 64-bit environment (eg n32 or n64 execution). They throw a fatal > > machine error if you execute them in o32 land. > > > > And I think the proper ifdef for this is defined(mips) && > > !defined(__mips_n64) && !defined(__mips_n32) or something horrible like > > that to not pessimize 64-bit executions. > > > > And powerpc will require something of similar sort (as reported by Mark > MIllard). It gets quite ugly indeed. > > I don't have strong opinion how to express the ifdefs, I think this is > least > bad if sticking to a mi header: > > 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 > + > +#if defined(__powerpc__) && !defined(__powerpc64__) > #define UNR64_LOCKED > #endif > We should move the defining of this to machine/atomic.h as suggested elsewhere. Once it's more than one phrase long, it makes no sense to pollute the MI header with MD stuff like this. Warner