From owner-svn-src-all@freebsd.org Mon Feb 10 16:32:10 2020 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 0F5BC23DF65; Mon, 10 Feb 2020 16:32:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48GWdj6hYQz3Bnd; Mon, 10 Feb 2020 16:32:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.2] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 6A9A129C8; Mon, 10 Feb 2020 16:32:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r357728 - head/sys/sys To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202002101352.01ADqQLh039003@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <2e247a51-8c57-5259-ad66-50f4db4e5286@FreeBSD.org> Date: Mon, 10 Feb 2020 11:32:11 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <202002101352.01ADqQLh039003@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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: Mon, 10 Feb 2020 16:32:10 -0000 Hi; On 10/02/2020 08:52, Mateusz Guzik wrote: > Author: mjg > Date: Mon Feb 10 13:52:25 2020 > New Revision: 357728 > URL: https://svnweb.freebsd.org/changeset/base/357728 > > Log: > Tidy up zpcpu_replace* > > - only compute the target address once > - remove spurious type casting, zpcpu_get already return the correct type > > While here add missing newlines to other routines. > > Modified: > head/sys/sys/pcpu.h For the record, this file (and many others), uses a space after #define, when we should be using a tab to conform with style(9). One of the many lessons from bde. I have a huge patch to fix those, which I won't commit because it wouldl obliterate all VCS annotations. Pedro. > Modified: head/sys/sys/pcpu.h > ============================================================================== > --- head/sys/sys/pcpu.h Mon Feb 10 13:24:14 2020 (r357727) > +++ head/sys/sys/pcpu.h Mon Feb 10 13:52:25 2020 (r357728) > @@ -245,32 +245,41 @@ extern struct pcpu *cpuid_to_pcpu[]; > * If you need atomicity use xchg. > * */ > #define zpcpu_replace(base, val) ({ \ > - __typeof(val) _old = *(__typeof(base))zpcpu_get(base); \ > - *(__typeof(val) *)zpcpu_get(base) = val; \ > + __typeof(val) *_ptr = zpcpu_get(base); \ > + __typeof(val) _old; \ > + \ > + _old = *_ptr; \ > + *_ptr = val; \ > _old; \ > }) > > #define zpcpu_replace_cpu(base, val, cpu) ({ \ > - __typeof(val) _old = *(__typeof(base))zpcpu_get_cpu(base, cpu); \ > - *(__typeof(val) *)zpcpu_get_cpu(base, cpu) = val; \ > + __typeof(val) *_ptr = zpcpu_get_cpu(base, cpu); \ > + __typeof(val) _old; \ > + \ > + _old = *_ptr; \ > + *_ptr = val; \ > _old; \ > }) > > #define zpcpu_set_protected(base, val) ({ \ > MPASS(curthread->td_critnest > 0); \ > __typeof(val) *_ptr = zpcpu_get(base); \ > + \ > *_ptr = (val); \ > }) > > #define zpcpu_add_protected(base, val) ({ \ > MPASS(curthread->td_critnest > 0); \ > __typeof(val) *_ptr = zpcpu_get(base); \ > + \ > *_ptr += (val); \ > }) > > #define zpcpu_sub_protected(base, val) ({ \ > MPASS(curthread->td_critnest > 0); \ > __typeof(val) *_ptr = zpcpu_get(base); \ > + \ > *_ptr -= (val); \ > }) >