From owner-svn-src-head@freebsd.org Fri Apr 24 15:12:06 2020 Return-Path: Delivered-To: svn-src-head@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 EE4822B8304 for ; Fri, 24 Apr 2020 15:12:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (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 497yMB1yckz4Vf2 for ; Fri, 24 Apr 2020 15:12:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x743.google.com with SMTP id l78so10454861qke.7 for ; Fri, 24 Apr 2020 08:12:06 -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=42kiS6Dp06mBKrDgwNMYm6AYvLDx0Px0MXAWSx6mDkQ=; b=2FboUID5zUgxLwMSqyIHDNk7ZCbDfPqm7tjkCRvebdyUG1VG5DVyalIKxIU/bdX2VA 7oorT+NVJlZceTTYe70N62ELzNeKaiGSPNubOczB82V2HZCTZo2En+zbT4YfYbuPpnw3 FJ+PFPcLepkJR7ElYeHSxKeT55ql0xQwCB1aclOyFEhpRW6XkMJJLgjcJHMgJFjOJF0K vHvg8W8dbfyNa/jj/x7nknp1ls27BJj7hlORR0A1kjnAIOKN1ICAtBToVjPb54Og358Z nXDgrH6M5fPJgjNVLwMRM0YGe9cAkjxmmleVqK+oAw+NND1s7RxqYndu1dUwhX2sqjVP RIUg== 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=42kiS6Dp06mBKrDgwNMYm6AYvLDx0Px0MXAWSx6mDkQ=; b=PTC00FNmuAp46bMr3eLqxtcxXlQe/nXequ1b0JhOHN6NFxBgypfU5UIqrOu6V0pwQv yW9lQ6mdXAyrMzvu9ri0tBRXGcPGuaqBTXWOmrYIxaPtJ60+An+sTPQRcmzBqlynkRfy KgPdDoiJkplyq/+vnVTLioCkRzELYK5KzCIM/XlBFq9j91op1JesCqPqix6lTIBcmlaz 0u0r2g0as6GtzPZ1uZnRf+OpYzXVCCW43nNoAnhPGE3gd0XCNUqkBMH2ThO2av8OJj5I Y1YD+LktvG52MmVwkJT3qTTJrrwXsTAHBBRl4ncpwSZ/XkmgWfeHh/T9QjWXGC6+ULmh 87zA== X-Gm-Message-State: AGi0PubAR3f1NssF/UVMGzOY4wcOMNu8LqdGqfRIbsTgep9YMmEg+byN gCBFt1gqsgrCUUA8rR752EpTxJ3pdLjlehioxSNMhg== X-Google-Smtp-Source: APiQypLzHhTzXZ9PBmxnyJzaApyCPrZI9HvqMrOiqapVvPxi3s+RkcomKpG92JQqMj1rgG9MqULCt8RAZ33V38oIEp8= X-Received: by 2002:a37:ac6:: with SMTP id 189mr9662212qkk.60.1587741123760; Fri, 24 Apr 2020 08:12:03 -0700 (PDT) MIME-Version: 1.0 References: <202004240749.03O7nMSc066344@repo.freebsd.org> <32586115-2c82-2497-ba4c-b3471887518d@FreeBSD.org> In-Reply-To: <32586115-2c82-2497-ba4c-b3471887518d@FreeBSD.org> From: Warner Losh Date: Fri, 24 Apr 2020 09:11:52 -0600 Message-ID: Subject: Re: svn commit: r360241 - head/sys/dev/ichiic To: Andriy Gapon , John Baldwin Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 497yMB1yckz4Vf2 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=2FboUID5; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::743) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.13 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.98)[-0.984,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.4.7.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]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.16)[ip: (0.01), ipnet: 2607:f8b0::/32(-0.33), asn: 15169(-0.43), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2020 15:12:07 -0000 On Fri, Apr 24, 2020 at 8:47 AM Andriy Gapon wrote: > On 24/04/2020 17:29, Warner Losh wrote: > > > > > > On Fri, Apr 24, 2020 at 1:49 AM Andriy Gapon > > wrote: > > > > Author: avg > > Date: Fri Apr 24 07:49:21 2020 > > New Revision: 360241 > > URL: https://svnweb.freebsd.org/changeset/base/360241 > > > > Log: > > ig4: ensure that drivers always attach in correct order > > > > Use DRIVER_MODULE_ORDERED(SI_ORDER_ANY) so that ig4's ACPI > attachment > > happens after iicbus and acpi_iicbus drivers are registered. > > > > I have seen a problem where iicbus attached under ig4 instead of > > acpi_iicbus when ig4.ko was loaded with kldload. I believe that > that > > happened because ig4 driver was a first driver to register, it > attached > > and created an iicbus child. Then iicbus driver was registered > and, > > since it was the only driver that could attach to the iicbus child > > device, it did exactly that. After that acpi_iicbus driver was > > registered. It would be able to attach to the iicbus device, but > it was > > already attached, so nothing happened. > > > > > > Can you post more details of which devices are affected? From the > description > > and the patch, I don't see how this could fix things. > > I think I listed them all: ig4iic with acpi attachment, iicbus and > acpi_iicbus. > acpi > \--- ig4iic > \---- iicbus vs acpi_iicbus > > I tried to explain the problem and the fix in the commit message. If you > want > to discuss any specifics, let's continue with specifics. If there is > anything > unclear in my explanation, I can clarify, but I need to understand what > needs to > be clarified. > That won't fix the stated problem. If changing the module order fixes something, it's the wrong fix. Which is why I asked to make sure I understood the issue (it was unclear if it was at the level indicated, or for the children of the iicbus). iicbus returns BUS_PROBE_GENERIC (-100) from its probe routine, while acpi_iicbus returns BUS_PROBE_DEFAULT (-20). This means that acpi_iicbus should always win. So something else is going on. We don't specify order on other devices except for some weird, special needs drivers (this is not such a driver). Unless I'm mistaken, the real problem is that the following line is missing instead. MODULE_DEPEND(ig4iic, acpi_iicbus, 1, 1, 1); which makes the module dependencies explicit. Can you add that to ig4_acpi.c, revert your change and see if that works? It will ensure that the acpi_iicbus driver is loaded first. If things break because it isn't, it sounds like a hard dependency for ig4. Since we're already pulling in acpi, that doesn't seem unreasonable to me. Warner > > > MFC after: 2 weeks > > > > Modified: > > head/sys/dev/ichiic/ig4_acpi.c > > > > Modified: head/sys/dev/ichiic/ig4_acpi.c > > > ============================================================================== > > --- head/sys/dev/ichiic/ig4_acpi.c Fri Apr 24 05:05:58 2020 > > > (r360240) > > +++ head/sys/dev/ichiic/ig4_acpi.c Fri Apr 24 07:49:21 2020 > > > (r360241) > > @@ -192,5 +192,6 @@ static driver_t ig4iic_acpi_driver = { > > sizeof(struct ig4iic_softc), > > }; > > > > -DRIVER_MODULE(ig4iic, acpi, ig4iic_acpi_driver, ig4iic_devclass, 0, > 0); > > +DRIVER_MODULE_ORDERED(ig4iic, acpi, ig4iic_acpi_driver, > ig4iic_devclass, 0, 0, > > + SI_ORDER_ANY); > > MODULE_DEPEND(ig4iic, acpi, 1, 1, 1); > > > > > -- > Andriy Gapon >