Received: by 10.192.165.156 with SMTP id m28csp1303226imm; Wed, 18 Apr 2018 07:35:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx49S2+5V3toYiFcjyfcL+4oWZIHpfSjD3aYvhqP9i8QZjSaWX4PQzl+OsHzVHb5sLkNCa8I9 X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr2341902plb.208.1524062157330; Wed, 18 Apr 2018 07:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524062157; cv=none; d=google.com; s=arc-20160816; b=EOmnOwt2Gp2MinIP83nR3jS7oHvb7CVwUudOOKBgpiZKH2/nQStntNaofzu8dpFF50 d3KHmMg3xUipx9JzCxLnoEhamM1vBdBb816HYSpEd8sNt8lCYQ/PJs8dPs334gKWDUTD 6Cy20a80agHPOJEChjAhlwDZs0XgsAN3M6wL13r9yu6cNDBPPsz4ZIuuXgv8bTt8qiPl WJRR2fkCl5vzsuQlJXazkj/Wu/8SmMvQ5UZ6lWVU8dPa4fuRo7p87qHDWzXLdiKv2dOY 4mJKm8cL5i/b8XqriNvl2zttRZ/g0bWtDuJPGUtknoEhVZ8wSfn3FJMeiWKUuHty1Yco qeUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date:arc-authentication-results; bh=8Q4uNdavqKrnBUuxcom7eo+Dt9lO7OXY42umUXcPxj8=; b=inGxhYSo6quHZSJ5cg4KF8CDIPnudk1rtOf92Jj7uEPgtzdpq8BVVE9kg5C7u7HHVR qEiCfSygtu0VsexdfwCcKZp0c3Eyhy4i3UU941maGW/jFNnfuYwpI7aPXgHRBhlX5rV1 3q4oBUl5HF09qgiImByQ+3BtfnqHtn5udjTwfSjsvwYRk2FM4h3Lmy46wFTVtH8QaUk4 eAm9ND379/Er3zxJwgm6VA+rYmPiyN0+a30z2LncUSCjbuVDOIQpaQja0x7J7utYs0U+ dVcNpuinGvTCrVKRdVMTuduKBOkIN0OWqhKgRicTlNqmG5gt2xvjFfdHHjmkh7Ek2wWZ aexg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si1083614pgr.634.2018.04.18.07.35.41; Wed, 18 Apr 2018 07:35:57 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbeDROe2 (ORCPT + 99 others); Wed, 18 Apr 2018 10:34:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752684AbeDROe1 (ORCPT ); Wed, 18 Apr 2018 10:34:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 966CC8DC46; Wed, 18 Apr 2018 14:34:26 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76BB41134CCD; Wed, 18 Apr 2018 14:34:26 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w3IEYQes012904; Wed, 18 Apr 2018 10:34:26 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w3IEYQ6U012900; Wed, 18 Apr 2018 10:34:26 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 18 Apr 2018 10:34:26 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: "David S. Miller" , Eric Dumazet cc: Joby Poriyath , Ben Hutchings , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: don't use kvzalloc for DMA memory Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 18 Apr 2018 14:34:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 18 Apr 2018 14:34:26 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch 74d332c13b21 changes alloc_netdev_mqs to use vzalloc if kzalloc fails (later patches change it to kvzalloc). The problem with this is that if the vzalloc function is actually used, virtio_net doesn't work (because it expects that the extra memory should be accessible with DMA-API and memory allocated with vzalloc isn't). This patch changes it back to kzalloc and adds a warning if the allocated size is too large (the allocation is unreliable in this case). Signed-off-by: Mikulas Patocka Fixes: 74d332c13b21 ("net: extend net_device allocation to vmalloc()") --- net/core/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-2.6/net/core/dev.c =================================================================== --- linux-2.6.orig/net/core/dev.c 2018-04-16 21:08:36.000000000 +0200 +++ linux-2.6/net/core/dev.c 2018-04-18 16:24:43.000000000 +0200 @@ -8366,7 +8366,8 @@ struct net_device *alloc_netdev_mqs(int /* ensure 32-byte alignment of whole construct */ alloc_size += NETDEV_ALIGN - 1; - p = kvzalloc(alloc_size, GFP_KERNEL | __GFP_RETRY_MAYFAIL); + WARN_ON(alloc_size > PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER); + p = kzalloc(alloc_size, GFP_KERNEL | __GFP_RETRY_MAYFAIL); if (!p) return NULL;