From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by dpdk.org (Postfix) with ESMTP id 6FCB01B114 for ; Wed, 19 Sep 2018 21:10:35 +0200 (CEST) Received: by mail-pf1-f182.google.com with SMTP id k21-v6so3134499pff.11 for ; Wed, 19 Sep 2018 12:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=2xwY7afSn0C9YHaRr/n8PCrj5SkSVldpZUr9VUyh1Go=; b=tw1ixa58zkYzFRMLdaIVzX4SyxxVkxW0OR7JoKn1uK+c50ckR5peTzDIlb2yfeO7gJ vAvzo2DD4UDVMgzcK4ienn+7JSSOBa1u5kF6mgTE6Ra5J2tGG2Zbqyoopk4u3eRJuBw3 AWYGWovhsrub69bsgzYufRNddq4JXkgTNq5iLqZfX8ViTrZV+YoNyGl9dLrWfPLZm3Er Or95Yyz8JTxyxN7+KgT520V1/YHsNuD6nK3XxwIvsaoF1mG9r3iuEeJV2ZhDl3GBb0pW D8XiAnAgqzbl8valj41R3BsWwvn/eO9A/bSlEpHu4k5QObpSyJ4b5LQ1tOZRgsLTogzK TDbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=2xwY7afSn0C9YHaRr/n8PCrj5SkSVldpZUr9VUyh1Go=; b=o0neW83+35rWBWdnHOyE3V/cWQQa1wcZD/vKTZ4bARDXm41sQiL1DeLfqNypi9BVJ3 OYCVu0Ixcx70L62ZzCjnPwVbjMC8uEdiBVWTTxb5kLIhurtxWlmJ1kIv3RRy7ZudJCpQ hdOl0+E5R8T2d1T49dVU5hPoCxxRL7jwlC0s4XrJky/rvfoIEKWdoUk87d/BMNFUtSkv cmBWBZQt1dd5GXW39ZM/sOtYPY45unF7PSG0s7WlP9Mhr/fRCrWrISqcvRfRyCAp0Gjm 5K0QRWpiOnXOn96Xt0B//ffusytMvIRzGpz6bqn+5/Fpzip7zADw0Z5/sb+7Fc649kUh gCIA== X-Gm-Message-State: APzg51BYKqYJJdgSWKA/VCX3fpvZyUz4uw+oh7BSeK+ZGOUSnRraimip lFig9Ziyg8aXA/24QOTRaBpgVfbZLNA= X-Google-Smtp-Source: ANB0VdazmE1iP5bPcSIF4cN+J1ig2ZxddFH9OL35Y2Kp7v3JE6SxBq3WSvvlo7A5eKrCXu3ZurWDew== X-Received: by 2002:a63:f043:: with SMTP id s3-v6mr30253791pgj.94.1537384234330; Wed, 19 Sep 2018 12:10:34 -0700 (PDT) Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 8-v6sm25501646pgu.10.2018.09.19.12.10.34 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Sep 2018 12:10:34 -0700 (PDT) Date: Wed, 19 Sep 2018 12:10:27 -0700 From: Stephen Hemminger To: dev@dpdk.org Message-ID: <20180919121027.57857295@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] vhost memory hotplug deadlock 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: Wed, 19 Sep 2018 19:10:35 -0000 The Vhost memory handling will self deadlock. The sequence is: rte_zmalloc malloc_heap_alloc heap_alloc_on_socket alloc_more_mem_on_socket try_expand_heap_primary Acquires memory_hotplug_lock for write eal_memalloc_mem_event_notify vhost_user_mem_event_cb vhost_kernel_ioctl rte_memseg_contig_walk Deadlocks acquiring memory_hotplug_lock for read The following may fix it. diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index d1be82162609..549235df0ca2 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -115,7 +115,8 @@ prepare_vhost_memory_kernel(void) wa.region_nr = 0; wa.vm = vm; - if (rte_memseg_contig_walk(add_memory_region, &wa) < 0) { + /* memory_hotplug_lock already held */ + if (rte_memseg_contig_walk_thread_unsafe(add_memory_region, &wa) < 0) { free(vm); return NULL; }