Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 May 2019 21:45:07 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Doug Moore <unkadoug@gmail.com>
Cc:        Bruce Evans <brde@optusnet.com.au>, Doug Moore <dougm@freebsd.org>,  src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r347484 - head/sys/kern
Message-ID:  <20190512212143.M868@besplex.bde.org>
In-Reply-To: <c26c6fa5-abc5-dace-f68c-f224bdaddd1a@gmail.com>
References:  <201905110909.x4B99A5L006389@repo.freebsd.org> <20190511202741.H1251@besplex.bde.org> <c26c6fa5-abc5-dace-f68c-f224bdaddd1a@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 11 May 2019, Doug Moore wrote:

> On 5/11/19 5:52 AM, Bruce Evans wrote:
>> On Sat, 11 May 2019, Doug Moore wrote:
>>> +#ifdef HAVE_INLINE_FFS
>>> +=C2=A0=C2=A0=C2=A0 case sizeof(int):
>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (ffs(mask) - 1);
>>> +#endif
>>
>> This is unreachable, since sizeof(int) is 4 on all supported arches, and
>> sizeof(mask) is 8 on all arches.
>>
> Another FreeBSD developer has expressed to me that sizeof(mask) ought to
> become 4 on some 32-bit arches before too long, and I added this case in
> anticipation of that.=C2=A0 I see now that I should have waited.

I also don't like the use of unsigned long for __fd_mask and bitstr_t.
This asks for a a pessimal type that is twice as wide as a machine
register, but is not so pessimal in practice since longs are rarely
implemented correctly except on systems with 16-bit machine registers.

The mask type u_daddr_t is both logically wrong (masks have nothing to
do with daddr_t's) and gives a pessimal bitstring type more often in
practice:
- in FreeBSD-4, [u_]daddr_t was 32 bits, so misusing it for bitstrings
   was pessimal on 64-bit arches
- expanding [u_]daddr_t to 64 bits in FreeBSD-5 (r96572-96851 only 17
   years ago) made it pessimal for bitstrings on 32-bit arches.

The pessimization would be smaller if ffs64() exists and is inlined to
32-bit ffs()'s.

Using the long long abomination asks for double the pessimizations and
machine dependencies as using long.  In practice, expanding long long
to larger than 64 bits would break ABIs so it is not much worse than
a spelling error for int64_t.

Bruce
From owner-svn-src-head@freebsd.org  Sun May 12 15:27:02 2019
Return-Path: <owner-svn-src-head@freebsd.org>
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 2A16E15999F4;
 Sun, 12 May 2019 15:27:02 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (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 "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id C270B72DC9;
 Sun, 12 May 2019 15:27:01 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FDF92C68F;
 Sun, 12 May 2019 15:27:01 +0000 (UTC)
 (envelope-from manu@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4CFR1w1071629;
 Sun, 12 May 2019 15:27:01 GMT (envelope-from manu@FreeBSD.org)
Received: (from manu@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4CFR1eO071628;
 Sun, 12 May 2019 15:27:01 GMT (envelope-from manu@FreeBSD.org)
Message-Id: <201905121527.x4CFR1eO071628@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: manu set sender to
 manu@FreeBSD.org using -f
From: Emmanuel Vadot <manu@FreeBSD.org>
Date: Sun, 12 May 2019 15:27:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r347512 - head/sys/arm/allwinner/clkng
X-SVN-Group: head
X-SVN-Commit-Author: manu
X-SVN-Commit-Paths: head/sys/arm/allwinner/clkng
X-SVN-Commit-Revision: 347512
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Rspamd-Queue-Id: C270B72DC9
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-2.94 / 15.00];
 local_wl_from(0.00)[FreeBSD.org];
 NEURAL_HAM_MEDIUM(-1.00)[-0.997,0];
 NEURAL_HAM_SHORT(-0.94)[-0.939,0];
 ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US];
 NEURAL_HAM_LONG(-1.00)[-1.000,0]
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 12 May 2019 15:27:02 -0000

Author: manu
Date: Sun May 12 15:27:01 2019
New Revision: 347512
URL: https://svnweb.freebsd.org/changeset/base/347512

Log:
  arm: allwinner: aw_clk_nm: Don't reparent the clock if we didn't ask
  
  When looking for the best frequency don't change the clock parent if the
  clock wasn't configured to do that.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nm.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk_nm.c	Sun May 12 12:30:45 2019	(r347511)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.c	Sun May 12 15:27:01 2019	(r347512)
@@ -236,7 +236,7 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare
 		return (ERANGE);
 	}
 
-	if (p_idx != best_parent)
+	if ((sc->flags & AW_CLK_REPARENT) != 0 && p_idx != best_parent)
 		clknode_set_parent_by_idx(clk, best_parent);
 
 	DEVICE_LOCK(clk);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190512212143.M868>