From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C48CAA0586; Wed, 19 Oct 2022 15:27:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77F3D427F3; Wed, 19 Oct 2022 15:27:42 +0200 (CEST) Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by mails.dpdk.org (Postfix) with ESMTP id B301D410D1 for ; Wed, 19 Oct 2022 15:27:40 +0200 (CEST) Received: by mail-ed1-f47.google.com with SMTP id t16so6015009edd.2 for ; Wed, 19 Oct 2022 06:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nnx9BUFCdon9/vq7FnCGev9XuhysLz1k6iMzUVAS6UY=; b=fg7RJlZyGpaGgBfsB30vG6sGRJyzbQDEy/deJ9vWM/GWImvlio7eQ9JD4AzeZElLRx LkdchzhE9mj9QpgwJmzFOjqnC7n5jmktkz5eI5gJlGgrbH2uBu1VBvcF/TkAPtbNSvno us7sgPs8Voysn9oSATlyRETUoptkVtDsINaDh4EOIXuE0+f1O3FlY0Mq+owuXXZZYj2o /2bKzun2HkbWhToKHrI3CB7Rg2Rb7P5S4X6K+kKq/CdVlb4Isnbjn7PmxGr9NVwInMef mjBj+zQ1nZGKph9O/sh+Q7w7I3KrMg+XbLgTkDkbCi3smz3EphRj38dLgPC6OQzXw0Kg bqOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nnx9BUFCdon9/vq7FnCGev9XuhysLz1k6iMzUVAS6UY=; b=x8BEt71AmT7SBebbHzIyJlyi2HzMfvYv9VrVp1NSuwJOYnaWTKOC/3+hDRVYcSJIqt Xbz11u7be+HYfbbKo17b9aOVkdMFasdl0PeejFAl2nGLNY7Y36HkTkcKWjHla3SmtE4A T9A5hVFdhNAZtWOUPYQg9Mu5wwS5wCJDEOtWKBJYLiwCH2+sn9f5HjrTIEFzxML1bHCM D1DZb++jb1yuSxbAt1HmiFnJvV5+qNfA4jK0DT+ujiYJ51jeKPSdDK7RuqvmWjcC53CK E1CcEebVROc68BzstqqXYBWGzmp0oST+2aNFVZKWWgeaKt9Y7uKU96FxjnUBBDwgNJpK +5iw== X-Gm-Message-State: ACrzQf0ls9eQ4p4HO51HPzI7iRSU/Z2TBw5XKrOE4jVdcoPj9dC00Zyu +owkEvQ/5podUyHiNijfZ4y1V+U9iu/PR5W6hhzl6A== X-Google-Smtp-Source: AMsMyM5qgKm9/R5/3dygXB1+6slDJMmKSAsmAKcCODRlL6uLGLIgTK8BleKULQE+5qG9ZzPOVYRjyVuG0TZNVCGpYJk= X-Received: by 2002:aa7:c78e:0:b0:456:c524:90ec with SMTP id n14-20020aa7c78e000000b00456c52490ecmr7470116eds.192.1666186060473; Wed, 19 Oct 2022 06:27:40 -0700 (PDT) MIME-Version: 1.0 References: <20221019104847.1699872-1-zhangfei.gao@linaro.org> In-Reply-To: From: Zhangfei Gao Date: Wed, 19 Oct 2022 21:27:28 +0800 Message-ID: Subject: Re: [PATCH] bus/vdev: vdev_cleanup checks dev->device.driver To: David Marchand Cc: Anatoly Burakov , Akhil Goyal , Fan Zhang , dev@dpdk.org, acc@openeuler.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, David On Wed, 19 Oct 2022 at 19:39, David Marchand wrote: > > On Wed, Oct 19, 2022 at 12:55 PM Zhangfei Gao wrote: > > > > The vdev_probe calls driver->probe, which may fail > > and dev->device.driver will still be NULL. > > > > In vdev_cleanup, drv = container_of(dev->device.driver) returns !NULL, > > then drv->remove will trigger Segmentation fault. > > Fix it by checking dev->device.driver first. > > > > Log: > > Thread 1 "dpdk-test" received signal SIGSEGV, Segmentation fault. > > 0x00000000012c484d in vdev_cleanup () > > I suspect you hit this issue when running some crypto autotest. > Can you confirm? Yes, I am testing uadk crypto autotest on x86, Since there is no hardware, so probe fail and return (which is expected) But quit dpdk-test triggered Segmentation fault $ sudo dpdk-test --vdev=crypto_uadk --log-level=6 vdev_probe(): failed to initialize crypto_uadk device EAL: Bus (vdev) probe failed. TELEMETRY: No legacy callbacks, legacy socket not created RTE>>quit Segmentation fault > > > The commit that introduced the issue should be mentionned, with a > Fixes: tag, like: > Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown") OK, will update Thanks David. > > > > > Signed-off-by: Zhangfei Gao > > --- > > drivers/bus/vdev/vdev.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c > > index f5b43f1930..fbdaf68380 100644 > > --- a/drivers/bus/vdev/vdev.c > > +++ b/drivers/bus/vdev/vdev.c > > @@ -577,6 +577,9 @@ vdev_cleanup(void) > > const struct rte_vdev_driver *drv; > > int ret = 0; > > > > + if (dev->device.driver == NULL) > > + continue; > > + > > drv = container_of(dev->device.driver, const struct rte_vdev_driver, driver); > > > > if (drv == NULL || drv->remove == NULL) > > If dev->device.driver != NULL, then drv won't be NULL. > > > -- > David Marchand >