From owner-svn-src-all@freebsd.org Mon Nov 19 01:39:02 2018 Return-Path: Delivered-To: svn-src-all@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 CB9FC112EE1C for ; Mon, 19 Nov 2018 01:39:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it1-x133.google.com (mail-it1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 1E3517A9FD for ; Mon, 19 Nov 2018 01:39:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it1-x133.google.com with SMTP id v11so5302609itj.0 for ; Sun, 18 Nov 2018 17:39:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HBcHhq/KmKRdZD8yY5f1Kjh8ICRJfUrUIYZizap95Y4=; b=m/PmqiSzBEHGv91yc5mwd40Hj6NY7r3eGHzE9snrjh+GPYCjA5PX2pjGv/gN2scVW9 1V+dMYzyIYRO4RYm3hSg4lS2oZTBe7wNeijHL2x0i2q3Cr0gUSvfvfW0hHil4XhTof2v 0MN20p79yJi3PG9+WCtEcShzIyQ2oKLAk5dZFfuo2Rue0tapF/GFwTNyC+Jf5FabykVj c9mxKHyP+QZeSvudAU9uFJDdkZC0YJx1NOSA9A79Grxmkk05ULO+y1aQjSM0kZoJKwW7 qzgESzeg8+eGFSg7K0IRqqu5lCOyjDQXZgVijUqefeOHCPQz2VzFnIsonVPT73F14bFh JiNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HBcHhq/KmKRdZD8yY5f1Kjh8ICRJfUrUIYZizap95Y4=; b=uW9iBpQSM8WqRUtbEsRXx4lztsKIhGFtsGtMHkZUp1kYhB8kWgVpOTxVcTsQn6UO26 bLasZI2jSIIzRreyJtLP4XQ5IkCox0m9DeE3evIzApeRsXzjPnoFKu3VTcAapBXwZGan On5O6kWvYHywO2uBpFff3KU5LmfylOPFeRnZYTP6nbZrFxOUvv6m5woAOwDivyLBB8bx a8jyvoGrjA9FXKvjvxHfzy9s6tumXSntu344hSjqdGjA72HLKtOY60j+08yXjaMv1ekI aMLMGIwpVgFFFhDXHwvR9/DL2imsybZSW7tGQf371U7pAu3znkbCkIspmdZGdcZE0NDI Plrg== X-Gm-Message-State: AA+aEWYBOgj/+Mo61LMs7WRxavtIPzvVX3wkopAH+Y1fQOBdbAYXeozM lUw176C9i1uRSrIG8UsgMNb8NE6Pn+BC4izpTNzOIg== X-Google-Smtp-Source: AFSGD/VdHFYgypdktNmadSKZfLqb06i96m4hJQ4Fq/322DOP6BYBuLJGxL2Hylts8XQb0qDgpfjAIGFzN7l3T4yjZgE= X-Received: by 2002:a24:3796:: with SMTP id r144-v6mr6544701itr.79.1542591540291; Sun, 18 Nov 2018 17:39:00 -0800 (PST) MIME-Version: 1.0 References: <201811190104.wAJ14CaE059062@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201811190104.wAJ14CaE059062@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Sun, 18 Nov 2018 18:38:49 -0700 Message-ID: Subject: Re: svn commit: r340450 - head/sys/sys To: "Rodney W. Grimes" Cc: Allan Jude , Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 1E3517A9FD X-Spamd-Result: default: False [-4.54 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[3.3.1.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.97)[-0.965,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.57)[ip: (-8.50), ipnet: 2607:f8b0::/32(-2.55), asn: 15169(-1.71), country: US(-0.09)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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, 19 Nov 2018 01:39:02 -0000 On Sun, Nov 18, 2018 at 6:04 PM Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > I don't see how this could possibly have changed things. The changes will > > change the least significant bit by one for fractional results. I've > looked > > at all the functions that use it and get called by the mlx driver and > have > > trouble seeing where it could be relevant... > > > > Can you do an experiment to let me know which of the three functions I > > changed breaks things? > > Alan well have to answer on that. I keep stairing at this > code change and I wonder.. has clang done something odd > with the - 1? What I read you trying to do is to remove > a LSB from a left shifted by 32 value, but what has clang > decided to do? Has it somehow gotten this wrong? Is there > some promottion of the type of the bare 1 causing an issue? > I'll talk to Allan to see if he can test that. the bare 1 should be handled properly because of C's promotion rules. 1ull << 32 is an unsigned long long. What I really wanted was "~(uint32_t)0" but that construct has bit me in the past. > Could you look at the assmbler output for your expression > and see that it does infact do what you expected it to do? > I haven't, but that's kinda hard since these are inline functions... I have some of this hardware at work, but don't think I have any machines with it assigned to me. If I can't work it out by the end of Tuesday, I'll back it out until I can get to the bottom of it (since I'll be out most of Wed->Sun). Warner > Thanks, > Rod > Scratching my head as much as anyone on this. > > > > > Warner > > > > On Sun, Nov 18, 2018 at 12:56 PM Allan Jude > wrote: > > > > > On 2018-11-15 11:02, Warner Losh wrote: > > > > Author: imp > > > > Date: Thu Nov 15 16:02:13 2018 > > > > New Revision: 340450 > > > > URL: https://svnweb.freebsd.org/changeset/base/340450 > > > > > > > > Log: > > > > When converting ns,us,ms to sbt, return the ceil() of the result > > > > rather than the floor(). Returning the floor means that > > > > sbttoX(Xtosbt(y)) != y for almost all values of y. In practice, > this > > > > results in a difference of at most 1 in the lsb of the sbintime_t. > > > > This difference is meaningless for all current users of these > > > > functions, but is important for the newly introduced sysctl > conversion > > > > routines which implicitly rely on the transformation being > idempotent. > > > > > > > > Sponsored by: Netflix, Inc > > > > > > > > > > This seems to break attaching for my mlxen(4), with or without r340451 > > > > > > I don't understand why at this point. > > > > > > Nov 18 19:28:12 CA-HML3-09 kernel: mlx4_core0: mem > > > 0xfbe00000-0xfbefffff,0xfa800000-0xfaffffff irq 48 at device 0.0 > > > numa-domain 1 on pci11 > > > Nov 18 19:28:12 CA-HML3-09 kernel: mlx4_core: Initializing mlx4_core > > > Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: command 0x4 timed out > (go > > > bit not cleared) > > > Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: device is going to be > reset > > > Nov 18 19:29:12 CA-HML3-09 kernel: mlx4_core0: device was reset > > > successfully > > > Nov 18 19:29:13 CA-HML3-09 kernel: mlx4_core0: QUERY_FW command failed, > > > aborting > > > Nov 18 19:29:13 CA-HML3-09 kernel: mlx4_core0: Failed to init fw, > aborting. > > > Nov 18 19:29:13 CA-HML3-09 kernel: device_attach: mlx4_core0 attach > > > returned 5 > > > > > > It works fine under r340449: > > > > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core0: mem > > > 0xfbe00000-0xfbefffff,0xfa800000-0xfaffffff irq 48 at device 0.0 > > > numa-domain 1 on pci11 > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core: Mellanox ConnectX core > > > driver v3.4.1 (October 2017) > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core: Initializing mlx4_core > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_core0: Unable to determine PCI > > > device chain minimum BW > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en mlx4_core0: Activating > port:1 > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: Ethernet address: > > > 00:02:c9:4d:6a:e8 > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlx4_core0: Port 1: Using > 32 > > > TX rings > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: link state changed to DOWN > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlx4_core0: Port 1: Using > 16 > > > RX rings > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Using 32 TX rings > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Using 16 RX rings > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Initializing port > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlx4_en: mlxen0: Link Down > > > Nov 18 19:46:07 CA-HML3-09 kernel: mlxen0: link state changed to UP > > > > > > > > > > > > > Modified: > > > > head/sys/sys/time.h > > > > > > > > Modified: head/sys/sys/time.h > > > > > > > > ============================================================================== > > > > --- head/sys/sys/time.h Thu Nov 15 08:43:17 2018 > (r340449) > > > > +++ head/sys/sys/time.h Thu Nov 15 16:02:13 2018 > (r340450) > > > > @@ -161,6 +161,10 @@ sbttobt(sbintime_t _sbt) > > > > * Decimal<->sbt conversions. Multiplying or dividing by SBT_1NS > > > results in > > > > * large roundoff errors which sbttons() and nstosbt() avoid. > > > Millisecond and > > > > * microsecond functions are also provided for completeness. > > > > + * > > > > + * These functions return the smallest sbt larger or equal to the > > > number of > > > > + * seconds requested so that sbttoX(Xtosbt(y)) == y. The 1 << 32 - 1 > > > term added > > > > + * transforms the >> 32 from floor() to ceil(). > > > > */ > > > > static __inline int64_t > > > > sbttons(sbintime_t _sbt) > > > > @@ -173,7 +177,7 @@ static __inline sbintime_t > > > > nstosbt(int64_t _ns) > > > > { > > > > > > > > - return ((_ns * (((uint64_t)1 << 63) / 500000000)) >> 32); > > > > + return ((_ns * (((uint64_t)1 << 63) / 500000000) + (1ull << > 32) - > > > 1) >> 32); > > > > } > > > > > > > > static __inline int64_t > > > > @@ -187,7 +191,7 @@ static __inline sbintime_t > > > > ustosbt(int64_t _us) > > > > { > > > > > > > > - return ((_us * (((uint64_t)1 << 63) / 500000)) >> 32); > > > > + return ((_us * (((uint64_t)1 << 63) / 500000) + (1ull << 32) - > 1) > > > >> 32); > > > > } > > > > > > > > static __inline int64_t > > > > @@ -201,7 +205,7 @@ static __inline sbintime_t > > > > mstosbt(int64_t _ms) > > > > { > > > > > > > > - return ((_ms * (((uint64_t)1 << 63) / 500)) >> 32); > > > > + return ((_ms * (((uint64_t)1 << 63) / 500) + (1ull << 32) - 1) > >> > > > 32); > > > > } > > > > > > > > /*- > > > > > > > > > > > > > -- > > > Allan Jude > > > > > > > > -- > Rod Grimes > rgrimes@freebsd.org >