From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757224AbbJVK30 (ORCPT ); Thu, 22 Oct 2015 06:29:26 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:54255 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756919AbbJVK3Y (ORCPT ); Thu, 22 Oct 2015 06:29:24 -0400 From: Arnd Bergmann To: Eric Auger Cc: eric.auger@st.com, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Date: Thu, 22 Oct 2015 12:29:13 +0200 Message-ID: <4304536.D7eNHjlsvD@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1445506922-6005-7-git-send-email-eric.auger@linaro.org> References: <1445506922-6005-1-git-send-email-eric.auger@linaro.org> <1445506922-6005-7-git-send-email-eric.auger@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:xfmkkeq/Fy7Df5fLqwm2YpG/u1mCdyl2ZWo0uWbji4/5nlQMG0E wMekfr0CxaRhDjpA7xA9oCF2E/oKmtTe+zJmj5jOhPSr8M2VBEmNJlSlFC+Tk/923ryhiSY IwHY45qyeaVo2GZatIi9gJl1r3YB0jW4sMtl9D1RPZV+JeY1L+8lUQgekB4qdyKjjBCiEOg gOkZRa8yfgPINfNBlhNew== X-UI-Out-Filterresults: notjunk:1;V01:K0:E3olrLwssDo=:+7W+ibNy8+hYVSV5nVCg9D n1hV1zlVGTaY9qB2bUJvjlADL6LPfuK6F1eJ0rslDwiRFmTielZ9vfgHMaiBC/CIG2VYK58Mk 8pC5rYIuIp1prpzdxt57+T+sFdyeeFjfqprcEuh8+GQdjhiwV7Bgy3axaGZVnl4iOdeMZypQk dbCItjlYKw0TNpQ9tg1S7VfxBgBQ8ziGMW4Bfp6zWd2Ih9zhR2ha2YfPwAAAJPZDPlL5/9Y4A FAO7csIG99zqcdGzWjB2Ig11H7P0ktRX2UEkOZUZV3soaaOg+1+HOfycIwYdKxuYo10Yydprb jtCgPWp7RBU7P33f41C+7XnJSeS7vpkKkjajUrLfelmE7cDbgwx+YzE+i6GLHSAD2rppY7SPQ sOPARdPmBzFyWRzf4ppSASZa1MHQn4VCywKipvfjMiyMr/963kifO6jaBaVQ/RQFABkVxelsS E0YyWTQ+CdKzmNFcGMyzwfE2YIy9i9tNdnmQPtPhOt4snf94M4stmj/+FRT8hUXJNVgAXlrlv La4kEKMzyP9tXiuM2kVOzCZh1xo8wWzysxOwNJuSl+kluwmiQhW/t06fhb8yVoYtl7wFH9LvM qCHV7ewB/AoMx+4MxoLF0FfpNffLXoqg67GYxkU4UiE21okVIZ7A92WthIG6CIaIHIJy18lSG 24aFNzmsjM/yPP0+9YKai3zOVfDDrQOmWZvMCrqTsT3ndY0ifwCddOmSapBKcc4gkOJR/pJzy k+ZI+zMwm02mewXm Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 22 October 2015 11:42:02 Eric Auger wrote: > Currently reset lookup is done on probe. This introduces a > race with new registration mechanism in the case where the > vfio-platform driver is bound to the device before its module > is loaded: on the load, the probe happens which triggers the > reset module load which itself attempts to get the symbol for > the registration function (vfio_platform_register_reset). The > symbol is not yet available hence the lookup fails. In case we > do the lookup in the first open we are sure the vfio-platform > module is loaded and vfio_platform_register_reset is available. > > Signed-off-by: Eric Auger I don't understand the explanation. I would expect the request_module() call to block until the module is actually loaded. Is this not what happens? > mutex_unlock(&driver_lock); > @@ -181,6 +182,8 @@ static int vfio_platform_open(void *device_data) > if (ret) > goto err_irq; > > + vfio_platform_get_reset(vdev); > + > if (vdev->reset) > vdev->reset(vdev); > This needs some error handling to ensure that the open() fails if there is no reset handler. Arnd