From owner-svn-src-all@freebsd.org Mon Nov 19 00:17:06 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 82CC5112C1FB for ; Mon, 19 Nov 2018 00:17:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it1-x132.google.com (mail-it1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (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 87A3477A5F for ; Mon, 19 Nov 2018 00:17:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it1-x132.google.com with SMTP id c9so5138323itj.1 for ; Sun, 18 Nov 2018 16:17:05 -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=lqyV1C+HVhjkZ1x5bKP3XBTA6rGWzb+UFHR7ckaAO/c=; b=0+sXn07VsjNdLNTgT2ECmOc5zf6pj91dcQ3DoqxDfp+dYYfQmo28A6S9qJ5Fb+YFjR G/iucMOgGQ28DTNnhxGK/MlZkDb11XU3TkIJG8TExijxnwpzRersCrkM25BePjnV2stM qpSAaBTKKMMB1GM6C939gmfBH+5gMSlc5uHAvHM49fkP67JDpX9hVnLlE1vrl+RC0EBJ unAQXM53Oghk/MV08JQHjRcKAqbCzvkekY5uyJBSq5wf8mmuUNa+EEu1Epqa4w6ARYTe qNEFfOLLn5PfzMRopXtEgJ9G7/2B/LWNrYpE+/X9YQpZ+TycKGLT88ek8LZ/j/f2487w O8vg== 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=lqyV1C+HVhjkZ1x5bKP3XBTA6rGWzb+UFHR7ckaAO/c=; b=WuAT2wJs3hDSt4EbDCY4jrvVnU7VHegiqAKkEIzQXhYHyhrbMWLNPH+oVn6WMA9EtY ExhZZQoFRwU+Dij2822L2r1hHHsDWTp0HjwkLdWvzjeaUCeF+qX+CpigvI/vZN824fo4 Q/UaA5hLXFt4U2iFD3hXaM4dTnWuXW/o78m5FHVu/yfqxgumZSIAXcmVZigZPPS91REo wvts8xTPSqhWhneKxMODJaGdrePYy4A/+Us9KAd25x4hEqnV1X6dY6Cr9MSLIT0pTloh DIL+4ozPo1oVxwqy2NU5HjhuH1Ycz1sde1JEJbA/7j9rv4kFB+tRbgizSHbRI3gasfhr I7NA== X-Gm-Message-State: AA+aEWYVwpOyzOJ06kb7wSVrRB7olAt7tmS/VOogYDnsmHuItlBARnYc TsbBI6PmGwU0knwLasLxrg4HAWdz2K89roxM8oA2Fg== X-Google-Smtp-Source: AJdET5c/GAlpZasFVc6U+VBTUE5gRlUDpFWiHUIULUDEN2aOFGOlrReL5ValK/JM4IXxDeTHr52ElraMhkgvrvHXACc= X-Received: by 2002:a24:5f94:: with SMTP id r142-v6mr6704199itb.171.1542586624557; Sun, 18 Nov 2018 16:17:04 -0800 (PST) MIME-Version: 1.0 References: <201811151602.wAFG2E4w040161@repo.freebsd.org> <595ff2c5-64ea-509d-481e-635499ab173d@freebsd.org> In-Reply-To: <595ff2c5-64ea-509d-481e-635499ab173d@freebsd.org> From: Warner Losh Date: Sun, 18 Nov 2018 17:16:53 -0700 Message-ID: Subject: Re: svn commit: r340450 - head/sys/sys To: Allan Jude Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 87A3477A5F X-Spamd-Result: default: False [-4.00 / 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)[5]; 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)[2.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.98)[-0.977,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.02)[ip: (-5.74), ipnet: 2607:f8b0::/32(-2.56), asn: 15169(-1.72), 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 00:17:06 -0000 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? 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 > >