From owner-svn-src-all@freebsd.org Tue Oct 8 14:14:22 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 C07B4129FDA; Tue, 8 Oct 2019 14:14:22 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46nfVP4spLz40PK; Tue, 8 Oct 2019 14:14:21 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd43.google.com with SMTP id u8so36795938iom.5; Tue, 08 Oct 2019 07:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eyMktLx5JKMlWEbWU62ntsOxTH35nhql57eSECllIYo=; b=bUXvj5pq7bZjBla21f4/q+XX708X6PJ2Lr7iHF2v9V/d5DArhNmDUPT4bk9HIOgAHw MKigwfybn8xM85vVG8UCeNHpawQAyXFxEb2wVB75i+TKgAsLuEVdYW6V9sqkiqmyu7LF sMmQs3oRUJPUN6CPX2kttkHw4Mqzkx/KKYvfuSYKqjPn7G5TleX9YmlKVdpk8nLmVCIL MwtDx+a+0qsQmUqNaK2QCJbrjTaj9gecadSRRDSgK3eiBS2KHFwolxTUWkt+Jnl22e3Z y0cYE3LmveNLA36+RBD7JImnx1/7BlDtT40IWDgG8ZrRaCJiOpbIbvQuZc4a5ZqH1Q1i Q8Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=eyMktLx5JKMlWEbWU62ntsOxTH35nhql57eSECllIYo=; b=Kr5vks/bqjyuW9fleNvwLG7R9bocQde+u8SqmArD4vipopzR5cGtuEtAKGgFqxL1Cj OMboAMNN2Qku4YT0VNVVl+LY0q2G5VbuM8I0zt5OWwy7z95uXb3A83dg0w/8Y0xKzQNv 281TRJYpQQQsliMqAbbYu0EIBU4nOtZu8MoEHVwhXUPJuNE3eH12Td7lwuE/kRSp3CdW vj7onJgLOjZK6Skn5kkHsUly+aqJLMnG8OL/Thx4kUXGbBQ389+3R1eQfQ1MhV+WknX9 JshqGfWDWsVKomwhIUdOq/o3VzaX3xS6YVPPYyX0rohPGrRgNYK6OLCPaobSVZ9Icjlw ZHHQ== X-Gm-Message-State: APjAAAXqdziFRLHqm2aPRL7plnx2dUB/016sCOWc+o1v4v52B31vNZdg NzqFhNifitNAqO8Kz7NC0TOH0doi X-Google-Smtp-Source: APXvYqytbCJgGzKvtLPmZ58a8e7rugbrH2mMv0cJmqXs3454bJs4cN0MmvfrjSz2+a4KGF63XQ89UA== X-Received: by 2002:a92:c8ca:: with SMTP id c10mr31538892ilq.68.1570544060056; Tue, 08 Oct 2019 07:14:20 -0700 (PDT) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id a25sm6601070iod.62.2019.10.08.07.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 07:14:19 -0700 (PDT) Sender: Justin Hibbits Date: Tue, 8 Oct 2019 09:14:14 -0500 From: Justin Hibbits To: Konstantin Belousov 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: <20191008091414.4ae66fb4@ralga.knownspace> In-Reply-To: <20191008081604.GZ44691@kib.kiev.ua> References: <201910080136.x981aYTq073145@repo.freebsd.org> <20191008081604.GZ44691@kib.kiev.ua> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46nfVP4spLz40PK X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=bUXvj5pq; dmarc=none; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::d43 as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-2.74 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.4.d.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]; IP_SCORE(-0.54)[ip: (2.04), ipnet: 2607:f8b0::/32(-2.54), asn: 15169(-2.14), country: US(-0.05)]; FORGED_SENDER(0.30)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[129.245.25.173.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; RCVD_TLS_ALL(0.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 14:14:22 -0000 On Tue, 8 Oct 2019 11:16:04 +0300 Konstantin Belousov wrote: > 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 ? No real significant reason. In fact, the review's diff has exactly what you're asking for. The only reason I modified it for commit with Kyle's work was purely readability, I thought using the C wrapper with atomic_fcmpset_() was just marginally cleaner. I haven't checked, but I don't think the inline code difference is too great, but I'll have to do another review of it to be sure. It's easy enough to commit the original diff over top instead, if that's the better way to go. - Justin