From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 1F6EE29CB for ; Fri, 30 Nov 2018 21:25:02 +0100 (CET) Received: by mail-pl1-f194.google.com with SMTP id b5so3337581plr.4 for ; Fri, 30 Nov 2018 12:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TPL+D7cldn7h0mE+OQDNXlU78NXhib4kncWd5ogs038=; b=eGkX7QL2RgmnoUWspQ9b2v1+AZYdD0l7tKCg5eyFzCaqlGPo0+2YO2RlrqsjrZA+wk rkhNufqhf8XasV5LPo8kIDANBL/oMnKFfOKJP7GSWSJsMzA7Hxc342uiuG9JR1U36z9p JeYsY3hlxH2muiLTc4pweNlo6c2mmQi1SDxP3tpo44ehQEXgk6gdmDxiNKxUfeu/uJ0W Uj2zkH2KEYEh9eAlkDj7ACMB2z0Offi2BeM5Np4qB7IcjphJTPySuWqxlq7nOB70vXeI iUi5FQ7Dy5fMXLso1SunESG2joxkE9WrpMyCa6nOn9F5L7/E6A5lumDv4dSMcZOLQAaw lqhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TPL+D7cldn7h0mE+OQDNXlU78NXhib4kncWd5ogs038=; b=YYvX5c5t4Yy9gvrBfNKqSujpyF9BTkQ5RbiPUb3CyL/Y14hSApROOMAsFtsZMu7/BE HfR2GPgv7+qJgT0EI+BLwhoU00wUPuoiW+37GvhLDftd9HbOUhueQcvfXpK64k9B/3Ty XnOT5FfNXfarw9p36UtBUVQggTphYAfjZ15av7fkOhZiyGak8MZ8UdHTh9npz3sO99NT KDPYT/lj/Bif6WeL+zAQPK2SDv9wLC7Awcjnr+WOMU04szXB8Dp/flyxtikDLCmTaBm5 9aqvVpczElmkW2zpNPjlwN6T8YwslciTbB/9JMU+QlitgBsVnJ6YkyLXwOXP1z5uSFny 3eAw== X-Gm-Message-State: AA+aEWaLOKl5eow4UP18Ws9IKERGrKQePjVEiSXbbvEn2w0SyGSUY8Ju 8DMO5Jd8cZ/bkdIeud+AZ0cFgRZ0NTA= X-Google-Smtp-Source: AFSGD/VQC+j8vrIY5A9Qvf62D3ddhxWjPJgPI4x7loar03HAL2Tx1lY2JRKtohRCdHvGGhxU33ApOQ== X-Received: by 2002:a17:902:bd92:: with SMTP id q18mr7064293pls.167.1543609500799; Fri, 30 Nov 2018 12:25:00 -0800 (PST) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 62sm6966308pgc.61.2018.11.30.12.24.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 12:25:00 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: mgamal@redhat.com, Stephen Hemminger , Stephen Hemminger Date: Fri, 30 Nov 2018 12:24:57 -0800 Message-Id: <20181130202457.10888-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <1543575881.5400.33.camel@redhat.com> References: <1543575881.5400.33.camel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] bus/vmbus: fix race in sub channel creation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2018 20:25:02 -0000 When using multiple queues, there was a race with the kernel in setting up the second channel. This is do due to a kernel change whiche does not allow accessing sysfs files for Hyper-V channels that are not opened. The fix is simple, just move the logic to detect not ready sub channels earlier in the existing loop. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Reported-by:Mohammed Gamal Signed-off-by: Stephen Hemminger --- drivers/bus/vmbus/linux/vmbus_uio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c index 12e97e3a420a..38df4d724ed5 100644 --- a/drivers/bus/vmbus/linux/vmbus_uio.c +++ b/drivers/bus/vmbus/linux/vmbus_uio.c @@ -357,6 +357,12 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, continue; } + if (!vmbus_isnew_subchannel(primary, relid)) + continue; /* Already know about you */ + + if (!vmbus_uio_ring_present(dev, relid)) + continue; /* Ring may not be ready yet */ + snprintf(subchan_path, sizeof(subchan_path), "%s/%lu", chan_path, relid); err = vmbus_uio_sysfs_read(subchan_path, "subchannel_id", @@ -370,12 +376,6 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary, if (subid == 0) continue; /* skip primary channel */ - if (!vmbus_isnew_subchannel(primary, relid)) - continue; - - if (!vmbus_uio_ring_present(dev, relid)) - continue; /* Ring may not be ready yet */ - err = vmbus_uio_sysfs_read(subchan_path, "monitor_id", &monid, UINT8_MAX); if (err) { -- 2.19.2