Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1593149pxa; Thu, 13 Aug 2020 12:03:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwFd9UYcDLwpYw/4iJcIrPgp/zYYxnXMXHy/2yskCXqModl7rkXYS3t8mJodgllSgh1WPA X-Received: by 2002:a17:906:c34e:: with SMTP id ci14mr6467322ejb.335.1597345439455; Thu, 13 Aug 2020 12:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597345439; cv=none; d=google.com; s=arc-20160816; b=ezIVAi/hGSVXA8JuTRhriswwkOgpGk531xH/5xDKRl9BGN6uUieTOyfnPSPm+nU91M 1mt+qCos4Zl/PQwOHajlrMzSQpMKdxx0NXkTF870E9YpN5v9CfUpuJLfJUvi1oUxJ5KI jQF7sFs3xgPnYao3BXgSFKpUELZlov1QvHegQEQhVYgty+rh1FhbVOxhc+warNbpAP8K sMmct8/TsGMWI+Bbo2zCjwBPU0hIgI2Vi3sLoc18UWrjeneIqOTf7P9Al0rakk/JkyAI MpNcL06EHY3L/PNA/E7LwPgBXSO0oq9yCtcDiIAPz4u//1xeoZ03yv9vRIp6P+6ENX0U 3LoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=exAlskjzIFOE1QMe0saylZOMoEP4iKWyM0PCmNmV2iE=; b=THtRCfZKwZxmTrPR80cN51ODPyjoHQfMePgofblWoomSniojzgMbFYfUzu5ZpMyqi2 xL2PCQoEB5b8UjAorkprTgWgJt1yYhlegisaBhnnbEbEDFXUSLwKoNly7mv3AxQpB7Ky hjAXSKqB/Hp3PvG8eJU8gdH91+nQ3X9I1mmkeMY3phiAzrMbMk0d4JK2II3ZHHOE+D8w o5C5D0OMir2t3lq7BT2E8SKRmei9cjmjS1YMMTxTI7WzRZZTbT9+fzrcda5csEf1iMPT 2Xslf7qOdSHryedX1zjCOqAZ6Kj+VSolf0g7Y65qE6zvlbfE2ZyFB20xUJ/Hh3It6exS AbDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=D+KqO8Dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k23si3651179ejg.514.2020.08.13.12.03.35; Thu, 13 Aug 2020 12:03:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=D+KqO8Dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbgHMTDD (ORCPT + 99 others); Thu, 13 Aug 2020 15:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgHMTDC (ORCPT ); Thu, 13 Aug 2020 15:03:02 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B908C061757 for ; Thu, 13 Aug 2020 12:03:02 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id 185so7359662ljj.7 for ; Thu, 13 Aug 2020 12:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=exAlskjzIFOE1QMe0saylZOMoEP4iKWyM0PCmNmV2iE=; b=D+KqO8DxYbapI0GwZR2nNjGv6dp+d+eVYzQHwg5OMjCbe3Q6SGne/SURb84sC+W4Bf WlFabSyY/QeiyaXTbQEFykeACFf5RZkc3ed28jFSDCVYw1jr/QDpijkI6yyaYHoDWcFI MCFoMmJ6MPdGoGJ2OI3Xt9c/mIbtsjp3OvXv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=exAlskjzIFOE1QMe0saylZOMoEP4iKWyM0PCmNmV2iE=; b=iI01lESinfGnj9jI9cX2VxX5CBrnuy2vWmDvW3HjcWcTCqCgfRXhNjqc3iVaNEIruA MFauCQ2ZjrLA7/uz6mV87MsxionuW6Xkz5q4ARuVWH/Qrxe5Xh2MNj1LjivMoY/4rovt HXK7dRdLWQKzoeWSU0C+wOGVCZYrGbqTk14SrqN+3egY6kuPJdGgblc9iLE2itj4x/Ys ZFS2vyG/ilGgS4IK9oled+EVwsOwbhcy7rpN6QsHwoho39fZ936ILhVAsa3A0abQ6ZzR QD9r3boet/0NkQCcKdaYjq9FrfAD18KkJ4wcAsZBGtjzMb3Hq9Nk0KYjHnf4cGut0V2y 9YrA== X-Gm-Message-State: AOAM532Z+ogQBOPybtN6ODeQpz708gF+SbYclWe0GYkjOdoi2RNRaQQK oFG04ZarWmfEN7W655ZxDSIxxOZnjVE= X-Received: by 2002:a2e:9595:: with SMTP id w21mr2793567ljh.334.1597345379648; Thu, 13 Aug 2020 12:02:59 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id c21sm1354603lfh.38.2020.08.13.12.02.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Aug 2020 12:02:58 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id w25so7342674ljo.12 for ; Thu, 13 Aug 2020 12:02:58 -0700 (PDT) X-Received: by 2002:a2e:9a11:: with SMTP id o17mr2566294lji.314.1597345377681; Thu, 13 Aug 2020 12:02:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Thu, 13 Aug 2020 12:02:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock() To: Hugh Dickins Cc: Christoph Hellwig , Andrew Morton , Dan Williams , Eric Dumazet , iommu , Linux Kernel Mailing List , Linux-MM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2020 at 8:17 PM Hugh Dickins wrote: > > Since commit 2a9127fcf229 ("mm: rewrite wait_on_page_bit_common() logic") > improved unlock_page(), it has become more noticeable how cow_user_page() > in a kernel with CONFIG_DMA_API_DEBUG=y can create and suffer from heavy > contention on DMA debug's radix_lock in debug_dma_assert_idle(). Ooh. Yeah, that's ridiculously expensive, and serializes things for no good reason. Your patch looks obviously correct to me (Christoph?), but it also makes me go "why are we doing this in the first place"? Because it looks to me like (a) the debug check is wrong (b) this is left-over from early debugging In particular, I don't see why we couldn't do a COW on a page that is under writeback at the same time. We're not changing the page that is doing DMA. In fact, the whole "COW with DMA" makes me feel like the real bug may have been due that whole "ambiguous COW" thing, which was fixed in 17839856fd58 ("gup: document and work around "COW can break either way" issue") That debug thing goes back almost 7 years, and I don't think it has caught anything in those seven years, but I could be wrong. The commit that adds it does talk about a bug, but that code was removed entirely eventually. And google shows no hits for debug_dma_assert_idle() since - until your email. So my gut feel is that we should remove the check entirely, although your patch does seem like a big improvement. Christoph? (And Dan too, of course, in case he happens to be relaxing in front of the computer away from a newborn baby ;) Linus