From owner-svn-src-head@freebsd.org Thu Nov 22 17:28:21 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 CFD95114CD82; Thu, 22 Nov 2018 17:28:20 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (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 44B177E1B0; Thu, 22 Nov 2018 17:28:20 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt1-x844.google.com with SMTP id p17so8125958qtl.5; Thu, 22 Nov 2018 09:28:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=T1K7xBYwwSWIfP8YrBX5MEiwIxTicRn7HRQUi4a/PMk=; b=rycF3iIHGKytC+QL6k84lxEMaZm+vuwmYNBdELj7RGjjPS0ixYCXjcr3IqeTtXAaWf PXUoOzUbOduvP76EuGDdzRwjHf8m5RBf3DfysYZfKorGpHeyCf8XRac5GO8OwbbDwDjL Kz+Mdq+ARvD1bBc7rj+N2b0lPdUlrqA2hHCdA62o3xm/otsA+/1KiVx2jtN6orDz/W06 3nHRZPrJOHRV9uWrD5ryZfikG803UD0Dy4dvaZeopvsmpdY6JYlVNv1BxSxddU2nNKmB Mx6lZ9VWfy21kGy/Wbt9PQTmxKKBJfRtW4ue8IMkkv3ZESlmX/TYnC2rpG4wVXrWh2Tw moLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=T1K7xBYwwSWIfP8YrBX5MEiwIxTicRn7HRQUi4a/PMk=; b=FJrQONlTohv3GZUbaDpPJ/mXOQYVnNEJoL7hXxEzpIl3r/cG/4xc4YpxYhbIX0NzSJ IzYY1Z2s6XRg3GKciBI8tlF/T6MG5aoUFOXSW3DlsKEjJ1iRjfZJQfCVKggafVESetD4 P7FxXj3O5jtpqfoRGfdAnM6jI8qAYXvWCoQwF8cxCunFBAeougLTtcl3yBT8ONYSpEkz YNlqtS6+4KK+RINMF05cNyGFscbINLhkZaoi3cLEHQyoarfcjKLDsjQoz+OcMlEVE2aU QGus6OHhh7DyOlqB8eMGPXyLxCYeGQFfb1j6gOApaTNYee1Uy6VPLj5UOQkPL0ac0/b2 KSqg== X-Gm-Message-State: AGRZ1gK7a7HVnbO0PF+oFfLEdQEihuUMDR88NWSQbbrlOg8MT6rVGNJN mjIdSrYaCy8XOrijS0v2XDG48QpJ+aJ6Wfg0mjs= X-Google-Smtp-Source: AFSGD/Wayi1GmD/67T/mLLPOel2fFN5qMZondQkLQ5J12GwLAhFloutbN8DnFt27NgNPDx0gfRHP2qyjPG6Xdhn6EIk= X-Received: by 2002:ac8:5053:: with SMTP id h19mr10683861qtm.280.1542907699918; Thu, 22 Nov 2018 09:28:19 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac8:784:0:0:0:0:0 with HTTP; Thu, 22 Nov 2018 09:28:19 -0800 (PST) In-Reply-To: References: <201811201458.wAKEwftP033152@repo.freebsd.org> <20181120150756.GD2378@kib.kiev.ua> From: Mateusz Guzik Date: Thu, 22 Nov 2018 18:28:19 +0100 Message-ID: Subject: Re: svn commit: r340676 - in head/sys: kern sys To: Warner Losh Cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 44B177E1B0 X-Spamd-Result: default: False [-2.64 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.59)[-0.587,0]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.21)[ip: (4.77), ipnet: 2607:f8b0::/32(-2.10), asn: 15169(-1.51), country: US(-0.09)]; NEURAL_HAM_LONG(-0.66)[-0.656,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[4.4.8.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.59)[-0.593,0]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_CC(0.00)[gmail.com] X-Rspamd-Server: mx1.freebsd.org 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:28:21 -0000 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 -- Mateusz Guzik