From owner-freebsd-net@freebsd.org Thu Feb 20 01:02:13 2020 Return-Path: Delivered-To: freebsd-net@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 484DF24A077 for ; Thu, 20 Feb 2020 01:02:13 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 48NGX41wMFz4K8J for ; Thu, 20 Feb 2020 01:02:12 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-qv1-f47.google.com with SMTP id n8so1113015qvg.11 for ; Wed, 19 Feb 2020 17:02:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Q9aNb1W+thn/WDfibfAZsHSPcusjN29vmP3t3tbPGvA=; b=c6J20JsJOA5J0bPmvNdKXspND/XS0WkiMayMUSGLCnK1CPfPt3pck9DqRyXdEVWJq7 +0zCyZKd1kpGX5jpkL5j31mXkQF5SV0OIc1Z6GovAtKO+YkQQGywotVf2iw9e59D7z8l addflS5r81cMnQ+jphTgxy4+kAoWFtoMFnOOBdZr75ly3uuB2x3jktycELz+SZAV3fT0 N7vf9/44suSdeYYdLt0ukHiys40eiCt01ZWSz12AD/If4yxR1sFgu66v/O44YlVzHc1/ cS/o0LpCafnEuvTDK3mSi4OHGUnC9ldJc9WJy7wfPoKpGdMfSJsdJH1KYHj4pYccilE/ 1nbQ== X-Gm-Message-State: APjAAAX+pG02RVpOgKfRDxiP4BiqkBvJolnK/2kKoKKECMOtcRSGPczH hOMSn9P/sfvopHD99w8V105kp3kmwQPay01DN6hPuA== X-Google-Smtp-Source: APXvYqyJEZWuAWxfbkgHfcSr4n/dGnjCNth5WF27cB76Up2Yr6KvJ34rxYJDziw80GrmHQuRsWQTLjDX+2bC1846nSs= X-Received: by 2002:a0c:fb0f:: with SMTP id c15mr22758282qvp.209.1582160529729; Wed, 19 Feb 2020 17:02:09 -0800 (PST) MIME-Version: 1.0 From: Adrian Chadd Date: Wed, 19 Feb 2020 17:01:58 -0800 Message-ID: Subject: epoch and ath(4) - what should we be doing? To: FreeBSD Net Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 48NGX41wMFz4K8J X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of adrianchadd@gmail.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=adrianchadd@gmail.com X-Spamd-Result: default: False [-1.94 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_TRACE(0.00)[0:+]; TO_DN_ALL(0.00)[]; IP_SCORE(-0.94)[ipnet: 209.85.128.0/17(-3.00), asn: 15169(-1.67), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[47.219.85.209.list.dnswl.org : 127.0.5.0]; SUBJECT_ENDS_QUESTION(1.00)[]; FORGED_SENDER(0.30)[adrian@freebsd.org,adrianchadd@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[47.219.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[adrian@freebsd.org,adrianchadd@gmail.com]; TO_DOM_EQ_FROM_DOM(0.00)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Feb 2020 01:02:13 -0000 hi! I'd like to update ath(4) to properly work with epoch, as that whole "oh make taskqueues epoch aware" is just not enough for ath(4). Background: * receive is done using deferred taskqueues, but * receive queues are drained/handled too outside of taskqueues - notably during interface resets, in order to not drop frames. So I'd like to convert it over to a normal taskqueue and just manually do EPOCH_ENTER / EPOCH_EXIT. It also means I can pepper assertions around ath(4) and net80211(4) to ensure that we're properly entering things with epoch held or not held. Questions: * are these things recursive? * what are the rules around sleeping? I've seen some ... discussions that were quite animated around this. * what should I be doing as an epoch tracker if I could call the receive routine from multiple paths. I see a few drivers have a single place where they're doing EPOCH_ENTER/EPOCH_EXIT using an epoch tracker allocated in the interrupt handler stack, but what if I also want to call that receive path from another function path too? Can I just stuff an epoch_tracker on the stack and it'll DTRT ? * .. is there some updated doc or brain dump somewhere I can read? I'd like to go add this to a couple out of tree wifi drivers under development so this would make that whole thing much easier. Thanks! -adrian