From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23407C433E0 for ; Thu, 30 Jul 2020 16:44:53 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCCFA20838 for ; Thu, 30 Jul 2020 16:44:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RY2n6Td8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCCFA20838 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lists.linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B3A2286D5D; Thu, 30 Jul 2020 16:44:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2UaQFq3Qjq3O; Thu, 30 Jul 2020 16:44:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id F014686D4D; Thu, 30 Jul 2020 16:44:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AC9CEC0050; Thu, 30 Jul 2020 16:44:51 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6221AC004D for ; Thu, 30 Jul 2020 16:44:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 479CF20533 for ; Thu, 30 Jul 2020 16:44:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RIwZdWPlKBMb for ; Thu, 30 Jul 2020 16:44:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by silver.osuosl.org (Postfix) with ESMTPS id 29C0420504 for ; Thu, 30 Jul 2020 16:44:48 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id k8so6835284wma.2 for ; Thu, 30 Jul 2020 09:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/WGqCOKip3V4asdK4kVZSLuOUEeNBpSCyttBdQXrjyQ=; b=RY2n6Td8Tl0tSuExkUbQNpMfcpseBvpu8JkBMp0qVCS5WE6XZPG7426ps4Fr6bN4L8 zoDJUkr0PIub4rwTuXkmHKJzE2kpPwn9jnoTowyaVoH/1cm4aqdhst+ZgjlGuhEzlf+v xahAZmxSN1q5k/z2rddgAhGICd1umbYqK70Yc= 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=/WGqCOKip3V4asdK4kVZSLuOUEeNBpSCyttBdQXrjyQ=; b=sgLLUBKzZPwI3tWZRvXQm3HfZCt0SCoPg8CNaoN/1FLvl91Syj4c5pzRqAMRHVzIOA le2oHpOlqFlBmzCnB/1TAaRcQ48H2Qn7DfRwlXJjMm8KOFXt6mg9b1m8vgI5lSVPBJdm aQz6tVeRfUIRixjtvGgoE6d7JqmvxhbB/4tfbgXW7sQjmRrddnvkPoBjIq5oYAeUZ/7F l/YIPl8EdwhupmHLYwUcDkEvj90tBsUQsPnQN0TKOtJw+XetXmhwJhKxiba8lMvPmgkk JkQ+aebJeQflHP1u1AIdkV6Y8Fjq8oaIARXc4riulWS8j5OztP8kTAfp2JBSQm6IleNF i6Tg== X-Gm-Message-State: AOAM530tMTDe9al6zZc75dWexA8qJ0nj9I/jMEdhOJGcQtNgNMsQsd1i Ziz7uSuZ2zAMZW3pQC1k+kIqQLeplzR6SWdXGZMrhw== X-Google-Smtp-Source: ABdhPJzPN/Gtn3yixsdd2Lbzp2FrZ7CbcVWH5kFgwvDKBPGWoM/jJv19H1hiW66ZlUHk1XI9xqRJk738HXFPzQ3IVyA= X-Received: by 2002:a1c:5459:: with SMTP id p25mr121162wmi.85.1596127486364; Thu, 30 Jul 2020 09:44:46 -0700 (PDT) MIME-Version: 1.0 References: <20200724203407.16972-1-james.quinlan@broadcom.com> <20200724203407.16972-9-james.quinlan@broadcom.com> <20200729061903.GA31671@lst.de> In-Reply-To: Date: Thu, 30 Jul 2020 12:44:33 -0400 Message-ID: Subject: Re: [PATCH v9 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset To: Rob Herring Cc: Rich Felker , "open list:SUPERH" , David Airlie , PCI , Hanjun Guo , "open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM" , Andy Shevchenko , Julien Grall , Heikki Krogerus , "H. Peter Anvin" , Will Deacon , Christoph Hellwig , "open list:STAGING SUBSYSTEM" , Jean-Philippe Brucker , Yoshinori Sato , Frank Rowand , "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" , Russell King , "open list:ACPI FOR ARM64 \(ACPI/arm64\)" , Chen-Yu Tsai , Ingo Molnar , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" , Alan Stern , Len Brown , Ohad Ben-Cohen , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Philipp Zabel , Arnd Bergmann , Suzuki K Poulose , Maxime Ripard , Florian Fainelli , Borislav Petkov , "open list:DRM DRIVERS FOR ALLWINNER A10" , Yong Deng , Santosh Shilimkar , Bjorn Helgaas , Thomas Gleixner , Mauro Carvalho Chehab , "moderated list:ARM PORT" , Saravana Kannan , Greg Kroah-Hartman , Oliver Neukum , "Rafael J. Wysocki" , open list , Paul Kocialkowski , "open list:IOMMU DRIVERS" , "open list:USB SUBSYSTEM" , Stefano Stabellini , Daniel Vetter , Sudeep Holla , "open list:ALLWINNER A10 CSI DRIVER" , Robin Murphy , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jim Quinlan via iommu Reply-To: Jim Quinlan Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, Jul 29, 2020 at 10:28 AM Rob Herring wrote: > > On Wed, Jul 29, 2020 at 12:19 AM Christoph Hellwig wrote: > > > > On Tue, Jul 28, 2020 at 02:24:51PM -0400, Jim Quinlan wrote: > > > I started using devm_kcalloc() but at least two reviewers convinced me > > > to just use kcalloc(). In addition, when I was using devm_kcalloc() > > > it was awkward because 'dev' is not available to this function. > > > > > > It comes down to whether unbind/binding the device N times is actually > > > a reasonable usage. As for my experience I've seen two cases: (1) my > > > overnight "bind/unbind the PCIe RC driver" script, and we have a > > > customer who does an unbind/bind as a hail mary to bring back life to > > > their dead EP device. If the latter case happens repeatedly, there > > > are bigger problems. > > > > We can't just leak the allocations. Do you have a pointer to the > > arguments against managed resources? I'm generally not a huge fan > > of the managed resources, but for a case like this they actually seem > > useful. If we don't use the managed resources we'll at leat need > > to explicitly free the resources when freeing the device. > > The lifetime for devm_kcalloc may not be what we want here. devm > allocs are freed on probe fail or remove, not on freeing the device > (there is a just in case free there too though). What do you suggest doing as an alternative? Jim > > > Rob _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu