Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1752322imm; Fri, 7 Sep 2018 05:43:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbwzRpKjhJTwQVnG/PDvs45g0oxuk0dB7lWCEvBzt7zPzchJImYXJx5SPiI3Z/k8UUyAHbQ X-Received: by 2002:a63:6283:: with SMTP id w125-v6mr7722949pgb.83.1536324201908; Fri, 07 Sep 2018 05:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536324201; cv=none; d=google.com; s=arc-20160816; b=DpcAT4pVWkpkfe2zovwBHVDFUDK6JsE/xNtMhyH3XjNFuGW1QjRGZdtg1whQL9avjZ YusIn6sLjjtw9TWx/1t3X+ZNXl83pGBhpXAUNxrIsz35g3ojI8iHZ1wqPkLrTuZgnmRI NGYGKOSPgxSsrXyMTRt+3FiEpS/Qnvpzr0P+8WrXvrD1M7m7I9QCLmVYIUMbSJxurAyi Au9Tc0M3JTYbeOYSp6ZVZDK+ZknOCp8L3PD4VlsEzoufLFd5xRDdn6ehd99J1n2Q0hkc rgFHa2v82WzR5egblHCICpmefP5j6sy4w6vA6hPz+oHNu9wdVz8nou1qZ3LPCbuL+VEp JlJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=ymOZgBAnvHhoJNgXBFKVfjedCZyvztEGs3i1TO+AF1I=; b=j77zKoHNsbuLznbdmX2R8pCk8XgTzI9dJJ0UbYL5an9znfehJlWsl6TQyA7KUj/tgl 5LBO1O1wJaWzB/ciMLz5JOXjVJIgzcW65t8CzOrU0XNTsBaD80MCJM9q8CTQowmFFMX7 9YmsCDnlbAjgbY7+XF9rflrUYfLYxzgRsqOLQpU7wntvk7PHkaSmyioMjibv1Ql/7CDa lz30EowIvockm2jz2Wz5JRfibGjwczG8SjsI3MDZUV+RFmQAENHLizQoo9LrDGwgUUaG QeFhBSYxolJHprtAizgqYfZolQ02lGPmC7A0sss0Sxxut4MdnpviIgdpyjEHY6DniIRP zLKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e68-v6si7919419plb.38.2018.09.07.05.43.06; Fri, 07 Sep 2018 05:43:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728598AbeIGPq5 (ORCPT + 99 others); Fri, 7 Sep 2018 11:46:57 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55877 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727378AbeIGPq5 (ORCPT ); Fri, 7 Sep 2018 11:46:57 -0400 Received: by mail-wm0-f66.google.com with SMTP id f21-v6so14328255wmc.5; Fri, 07 Sep 2018 04:06:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ymOZgBAnvHhoJNgXBFKVfjedCZyvztEGs3i1TO+AF1I=; b=W3TYTzvUly68b9SOX3M2oSz5HN1S1v46vonn+/vCUw+G1dKpb2E0UyAPOQRCdOV28u J3XjYDDJTAvhF5WNSl8AphgkZZOxh5zTR1H3Esxmm3kp7saKeyThuDce4w18/P6fLCtN khiYGKtYsuJ64Q8ohu2bvsLxS0twr/UL6s3CUuaI4SteVSuIm4S8CsLQtHdWiKlhs7aw 6TERFa8NpIvnI6h+5e7UWgz1WBctmp+p+oGTEP5GJuEVK3DxFTGEVGk/cACdBwYHrAbk 9gzMyBs+lbMp4VZVyhS+6K6cIJ4nBVakt4wIvtUCcVuLjYGoMmJ15q4C4jstws/WGnqf o/5w== X-Gm-Message-State: APzg51D/VJsXgK5B5f4qE/gTppv4WWhDUZPeiFTe4FuleNXurXF5wFB7 6sPNLWWhIpKCSnWgIsogbHs= X-Received: by 2002:a1c:be14:: with SMTP id o20-v6mr4970880wmf.73.1536318388110; Fri, 07 Sep 2018 04:06:28 -0700 (PDT) Received: from ?IPv6:2a01:4240:2e27:ad85:aaaa::70f? ([2a01:4240:2e27:ad85:aaaa::70f]) by smtp.gmail.com with ESMTPSA id v1-v6sm8016134wrt.34.2018.09.07.04.06.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 04:06:26 -0700 (PDT) Subject: Re: [Xen-devel] [PATCH] xen-netfront: wait xenbus state change when load module manually To: Boris Ostrovsky , Juergen Gross , Xiao Liang , David Miller Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org References: <20180727095608.25210-1-xiliang@redhat.com> <20180729.083040.53901922165497594.davem@davemloft.net> <60e93e09-7dc2-d2f6-379d-c1d086aa1f49@redhat.com> <83ad1e3c-5e3b-8b24-430b-13e12b59ae8b@suse.cz> <830d73b5-8bbb-4d9a-a004-7aeea0b35067@suse.com> <1a6b2326-78b3-f7fa-fb3b-08c54f4f9761@oracle.com> From: Jiri Slaby Openpgp: preference=signencrypt Autocrypt: addr=jslaby@suse.cz; prefer-encrypt=mutual; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs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AHCwV8EGAECAAkF Ak6S54YCGwwACgkQvSWxBAa0cEk3tRAAgO+DFpbyIa4RlnfpcW17AfnpZi9VR5+zr496n2jH /1ldwRO/S+QNSA8qdABqMb9WI4BNaoANgcg0AS429Mq0taaWKkAjkkGAT7mD1Q5PiLr06Y/+ Kzdr90eUVneqM2TUQQbK+Kh7JwmGVrRGNqQrDk+gRNvKnGwFNeTkTKtJ0P8jYd7P1gZb9Fwj 9YLxjhn/sVIhNmEBLBoI7PL+9fbILqJPHgAwW35rpnq4f/EYTykbk1sa13Tav6btJ+4QOgbc ezWIwZ5w/JVfEJW9JXp3BFAVzRQ5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+d yTKLwLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330m kR4gW6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/ tJ98f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCu jlYQDFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmf faK/S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= Message-ID: <172007cc-6a82-99dd-2d1e-5103a6c1b9b0@suse.cz> Date: Fri, 7 Sep 2018 13:06:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1a6b2326-78b3-f7fa-fb3b-08c54f4f9761@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/24/2018, 04:26 PM, Boris Ostrovsky wrote: > On 08/24/2018 07:26 AM, Juergen Gross wrote: >> On 24/08/18 13:12, Jiri Slaby wrote: >>> On 07/30/2018, 10:18 AM, Xiao Liang wrote: >>>> On 07/29/2018 11:30 PM, David Miller wrote: >>>>> From: Xiao Liang >>>>> Date: Fri, 27 Jul 2018 17:56:08 +0800 >>>>> >>>>>> @@ -1330,6 +1331,11 @@ static struct net_device >>>>>> *xennet_create_dev(struct xenbus_device *dev) >>>>>>       netif_carrier_off(netdev); >>>>>>         xenbus_switch_state(dev, XenbusStateInitialising); >>>>>> +    wait_event(module_load_q, >>>>>> +               xenbus_read_driver_state(dev->otherend) != >>>>>> +               XenbusStateClosed && >>>>>> +               xenbus_read_driver_state(dev->otherend) != >>>>>> +               XenbusStateUnknown); >>>>>>       return netdev; >>>>>>      exit: >>>>> What performs the wakeups that will trigger for this sleep site? >>>> In my understanding, backend leaving closed/unknow state can trigger the >>>> wakeups. I mean to make sure both sides are ready for creating connection. >>> While backporting this to 4.12, I was surprised by the commit the same >>> as Boris and David. >>> >>> So I assume the explanation is that wake_up_all of module_unload_q in >>> netback_changed wakes also all the processes waiting on module_load_q? >>> If so, what makes sure that module_unload_q is queued and the process is >>> the same as for module_load_q? >> How could it? Either the thread is waiting on module_unload_q _or_ on >> module_load_q. It can't wait on two queues at the same time. >> >>> To me, it looks rather error-prone. Unless it is erroneous now, at least >>> for future changes. Wouldn't it make sense to wake up module_load_q >>> along with module_unload_q in netback_changed? Or drop module_load_q >>> completely and use only module_unload_q (i.e. in xennet_create_dev too)? >> To me this looks just wrong. A thread waiting on module_load_q won't be >> woken up again. >> >> I'd drop module_load_q in favor of module_unload_q. > > > Yes, use single queue, but rename it to something more neutral. module_wq? Can somebody who is actually using the module fix this, please? I could fix it, but untested changes are "a bit" worse than tested changes. thanks, -- js suse labs