From owner-freebsd-hackers@freebsd.org Thu Aug 29 03:27:20 2019 Return-Path: Delivered-To: freebsd-hackers@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 0E0F0EEE88 for ; Thu, 29 Aug 2019 03:27:20 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (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 46Jp2H0wpbz46Hy for ; Thu, 29 Aug 2019 03:27:18 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f48.google.com with SMTP id d25so1441500iob.6 for ; Wed, 28 Aug 2019 20:27:18 -0700 (PDT) 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:reply-to :from:date:message-id:subject:to:cc; bh=n2mQQQPvZS+f5lPwa0zkwL9Dk0KGcUyBbWv5HmbRdY8=; b=Pi1CzqGy4Qb0FzY+zPaaf0a/nR8qSCrBrHY0l7kn5vMSA26Ct8Jrl5LnpTboUKqcc1 +vKAbA4a2f0bH3KO2U+wqiHn7bBpMXpPQ9r0a/X0+sXSB+TSy5+GnlRXpL7WEVCs+1jl 5AWLCO/cFEeVjF6PZpF85+oEfKcuZzrROolxeohCiEHEmZK8lnr4xKPmtS95e5ZPGfb0 iUSDM5bkldk5BZAmgJTvbEDaz9L5KCO9/DIRGLNYWBBwUcYSmlYB8zjhI+d7A3FlCn+e yVMhJOHvENxIAY8V65/ZvhxuBOar/ampKKtFf3LeBzd/cqde1Cop4MoQKnN+rIl5Ja1H Q4hw== X-Gm-Message-State: APjAAAViKrVjY7FRJ0rPz3wpsOGSMk7BiYrM7/R95QNaC/JI49S8OuCW 73IZio2T/atRzL7S27k4RazDGFls X-Google-Smtp-Source: APXvYqwKjTGZb1tQqe75ErDwQjizGn0Wt4+FCLpEWz3H+HlNHBKGozAO9Y3l7R4q+Uxe8zP0DYl9sA== X-Received: by 2002:a5d:8b8d:: with SMTP id p13mr8133995iol.62.1567049237520; Wed, 28 Aug 2019 20:27:17 -0700 (PDT) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com. [209.85.166.41]) by smtp.gmail.com with ESMTPSA id w6sm766399iob.29.2019.08.28.20.27.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Aug 2019 20:27:17 -0700 (PDT) Received: by mail-io1-f41.google.com with SMTP id z3so4062483iog.0 for ; Wed, 28 Aug 2019 20:27:16 -0700 (PDT) X-Received: by 2002:a02:b604:: with SMTP id h4mr7728121jam.78.1567049236478; Wed, 28 Aug 2019 20:27:16 -0700 (PDT) MIME-Version: 1.0 References: <7dfebbd3-85d6-c7b7-b83b-fae8b644649e@yuripv.net> <478965aa-5256-e356-5339-de6fb82c3459@selasky.org> <63daa36a-5c22-6b08-3cd7-562fa961ab61@yuripv.net> <7f6de96d-8b56-e242-8950-04a20b197bce@selasky.org> <311a21e3-ed61-8679-b416-b2a4c255c6e7@yuripv.net> <1f91f7a6-050d-d690-d374-6b06950d2ce2@yuripv.net> <4201916c-0f7f-0bf6-2d17-e9f6a1879ba7@yuripv.net> In-Reply-To: <4201916c-0f7f-0bf6-2d17-e9f6a1879ba7@yuripv.net> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Wed, 28 Aug 2019 20:27:05 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: ichsmb(4) and msleep() To: Yuri Pankov Cc: Warner Losh , FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46Jp2H0wpbz46Hy X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.48 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-5.62 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; MIME_TRACE(0.00)[0:+]; 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)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[48.166.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.63)[ip: (-7.42), ipnet: 209.85.128.0/17(-3.34), asn: 15169(-2.32), country: US(-0.05)]; RWL_MAILSPIKE_POSSIBLE(0.00)[48.166.85.209.rep.mailspike.net : 127.0.0.17]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2019 03:27:20 -0000 On Wed, Aug 28, 2019 at 6:35 AM Yuri Pankov wrote: > > Warner Losh wrote: > > What's the advantages of doing this instead of deferring attach until the > > interrupts are running? > > None that I can think of, just going with what was suggested and seeing > other drivers doing the same. Could you please name a driver that > defers attach until !cold? I think pretty much all drivers attach when interrupts are enabled (not the same as !cold)? At least x86 enables interrupts on BSP at SI_SUB_INTR, and DRIVER_MODULE drivers *load* at SI_SUB_DRIVERS, and the INTR one is ordered before the other. My skim read is that drivers do not actually attach until SI_SUB_CONFIGURE. I think the panic / test in sleepq_set_timeout_sbt is maybe overly strong? !cold indicates the entire autoconfigure process has concluded. But interrupts are available long before that. Seems like hardclock is started at ~SI_SUB_CLOCKS? Which is admittedly after DRIVERS, but still long before !cold. I'm not sure what set of interrupt/timer functionality is needed for sleepq, but likely that condition can be relaxed. If it cannot be relaxed enough for your driver, you could expand your DRIVER_MODULE() into the expanded macro, replacing SI_SUB_DRIVERS with a later stage. Best, Conrad