From owner-svn-src-all@freebsd.org Tue Oct 8 08:16:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6D4313EC2B; Tue, 8 Oct 2019 08:16:12 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46nVY83Tf8z4YhG; Tue, 8 Oct 2019 08:16:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x988G4Mg022128 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 8 Oct 2019 11:16:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x988G4Mg022128 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x988G46M022127; Tue, 8 Oct 2019 11:16:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 8 Oct 2019 11:16:04 +0300 From: Konstantin Belousov To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353296 - head/sys/powerpc/include Message-ID: <20191008081604.GZ44691@kib.kiev.ua> References: <201910080136.x981aYTq073145@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910080136.x981aYTq073145@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46nVY83Tf8z4YhG X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2019 08:16:12 -0000 On Tue, Oct 08, 2019 at 01:36:34AM +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Tue Oct 8 01:36:34 2019 > New Revision: 353296 > URL: https://svnweb.freebsd.org/changeset/base/353296 > > Log: > powerpc: Implement atomic_(f)cmpset_ for short and char > | > This adds two implementations for each atomic_fcmpset_ and atomic_cmpset_ > short and char functions, selectable at compile time for the target > architecture. By default, it uses a generic shift-and-mask to perform atomic > updates to sub-components of 32-bit words from . > However, if ISA_206_ATOMICS is defined it uses the ll/sc instructions for > halfword and bytes, introduced in PowerISA 2.06. These instructions are > supported by all IBM processors from POWER7 on, as well as the Freescale/NXP > e6500 core. Although the e5500 and e500mc both implement PowerISA 2.06 they > do not implement these instructions. > > As part of this, clean up the atomic_(f)cmpset_acq and _rel wrappers, by > using macros to reduce code duplication. > > ISA_206_ATOMICS requires clang or newer binutils (2.20 or later). Why don't you use normal word-sized ll/sc tlwarx/stwcx, and only modifying the part of the register as needed ? This would work on all supported CPUs, right ? When kevans did the _atomic_subword.h, one of the arches involved was sparc64, which does not have ll/sc. Also for MIPS there are some fine details which might mean that C implementation is less work than using word-sized ll/sc. But why for power ?