From owner-freebsd-current@freebsd.org Mon Jul 1 17:25:24 2019 Return-Path: Delivered-To: freebsd-current@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 9E4C115E05CF for ; Mon, 1 Jul 2019 17:25:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (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 EB0FA887DA for ; Mon, 1 Jul 2019 17:25:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82f.google.com with SMTP id d17so15475972qtj.8 for ; Mon, 01 Jul 2019 10:25:23 -0700 (PDT) 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=DWM+Ut0P/19uItBIedLKgTD94iOmE4mKo+jkd4URvhY=; b=bQlwOJ+0ZRxFF1ArT40yodEGYCiSTzUQVygo/bOoGoPcvbXJili3pc1Gwj1hOZ4T69 1kigexTo5+RU5b4U9fphDwu0aaOObkSajpOvuyd53hpw11f79l4+Aspx//ktmRDjJsvf IlsCPUMC92QwRfyBllYXpOxwaieW6Ov7viKz/mJnNAyt/FzDSqgyR97WIu1fzBVn35hk Kjxt/hcoEAyjcy179GbVop4kJ9D9vEfop4g6PhCMuFh7zkauxGH47bNttskvWLuBBAcR f1lFaOYHyZPnWGruVsYyzHQw+ILGuU3A2D5rmgTycJ4wbnjCtbE6MXFhod4WB4hGO1iM TkCA== 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=DWM+Ut0P/19uItBIedLKgTD94iOmE4mKo+jkd4URvhY=; b=dKQw2GpqYqGpIeaPm7EdfzvFmY/nGyBs3jB2jr99Jhft9PnudmwI0k2c/veuGHTyMf eHm36+o85fylsU+SkTHmwmBniL1R7y+fGp7zriIP/LssPOy6W0IKNb92LNwJY1FIzUJW XyAXdGYYxlmDUCkt1fD11Zpftxdqjx1tfX53QUGl4hF/8Z6g3upGgg54FnVR31Slk+lA nT6mpiGSMgPkJbrgFH9peN43ACElUPT9m6AuJbQAh0YW/ROAKDc/stxdzrmJbi+xiU/z 88zGzseLA8C3WWJ0miGV+irx4doHFSd/Yj6jlCpKGeg6p4b1D/VIryZj2z4troDqaSbW wFsw== X-Gm-Message-State: APjAAAXzVHUiPIy6KEnJpfYH8dlLBDlhtIbPPXEbdyFWd4JC/G9I7kac xSuHE92wawofvd85v3vyMXQNTxkPBv/K0V9A7Z0YLA== X-Google-Smtp-Source: APXvYqyFNHESqmXU7QAeK8bjm2I3zOFgIY2d7YOYEkANgrizRJ5I8BzLf2VtGzJpsxUsdA1wG9er02xFu4b4KOHL6og= X-Received: by 2002:ac8:2baa:: with SMTP id m39mr21780875qtm.242.1562001923324; Mon, 01 Jul 2019 10:25:23 -0700 (PDT) MIME-Version: 1.0 References: <7e5d8a06bc2d46263262369464e9348b82263847.camel@freebsd.org> <93148.1562001288@critter.freebsd.dk> In-Reply-To: <93148.1562001288@critter.freebsd.dk> From: Warner Losh Date: Mon, 1 Jul 2019 11:25:12 -0600 Message-ID: Subject: Re: i2c bit banging timeout for SCL To: Poul-Henning Kamp Cc: Ian Lepore , Andriy Gapon , FreeBSD Current X-Rspamd-Queue-Id: EB0FA887DA X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=bQlwOJ+0 X-Spamd-Result: default: False [-5.88 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(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)[f.2.8.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.89)[-0.886,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; IP_SCORE(-2.99)[ip: (-9.40), ipnet: 2607:f8b0::/32(-3.13), asn: 15169(-2.34), country: US(-0.06)]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jul 2019 17:25:24 -0000 On Mon, Jul 1, 2019 at 11:14 AM Poul-Henning Kamp wrote: > -------- > In message < > CANCZdfoFBvmxPtnEL4GOqXTvp6Zd-xrtja4rmUO1rAcy0JdeSw@mail.gmail.com>, > Warner Losh writes: > > >The only issue, really, is that this timeout is a busy loop and there may > >be I/O bus contention introduced on these systems. > > Does it have to be a busy loop for the entire duration ? > > Spin for the median, timeout+poll for the rest of the time ? > That's a good suggestion. I'd be inclined to spin for 1 tick or so, then do a timeout per tick after that (eg, shift from DELAY to pause(1)). It won't be super accurate or high performance, but when the devices are slow, that would add only a little extra time. Ideally, that's what we'd do. In the short term, bumping the timeout wouldn't be horrible. Warner