Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1710871rdb; Thu, 25 Jan 2024 04:04:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQsHjvG90IUNlUU06vufY3wUBdAp1GiV+uljJB1DEahD7DVLYwVvBS7TngKFqgW/5tmKu7 X-Received: by 2002:a50:c054:0:b0:55b:7fc5:b157 with SMTP id u20-20020a50c054000000b0055b7fc5b157mr574868edd.19.1706184299754; Thu, 25 Jan 2024 04:04:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706184299; cv=pass; d=google.com; s=arc-20160816; b=piUsvfziS+1ZskNjSNTtnrvQBbcNN53/8Zc9li2nLuAOALOXYdmA7YltlaPctIqQ5m N6DMzEnP5/mmumsKDCViUujs6SeUhJFY+nFYZ3IjVhR+M2+dQn7Xtw9ZBbJD7NCDjjN2 ifFHWChBu14xPDIZEs99PaGRydrId86VMrEqJ02PsFQXQ4P56JXXOkVfK0V2nt7/SsNZ XbVQMgYiA4E9D2F/yUZRH7X097mAbneZjbFhreExk/RvuQOge+9T0luzMKH0Rx8ZqdFc ehs33kkOmB+LnBDymYHeAgjurXjtLxqSwqrsul2bLsr0I9wZm/Fsu0rA6xgo8Sb2m/Ps Gjkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6lYVQnk1dr75H54hsrDzaukdKcg9OVhYKl+RGtltde8=; fh=zv3b7agrNaeEFRhY4GDwVw5suxM+XDJg1xiQ9xbDO0E=; b=edv9HFJLLQfgd5TmETpQ7DsdAtk37/9eZhBBbhlBACqhxpwSbuGk/JSxcusovT6su0 V2DsANcW3JsI8OHcTGFUUZlye9oCQqwHlS/5V+74NhhiDDvponbTTwxN3ktkRMewGHCI AQrqk8dSY8UVTeEQhCsFGAL+HkSoFL9CrWdTwzJl1x/jONw/qYkfkPM6nT3bF0AEzWmW lVKONQ+obWXidKOmE2hzw3kSdAyEiTKbSukQxC+PPU2ARY4JForetJtoJ2hAdPEA13TI x0GnSQtJIwDDnxYjdh80fOSTEMjz4X1enJEJ4yY/9DiipmlApuTwMXCO2U4bBqhDBuYM nobA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dSTgrFVZ; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i13-20020a05640242cd00b005538fc8a3f1si14522567edc.260.2024.01.25.04.04.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 04:04:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dSTgrFVZ; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8383F1F25990 for ; Thu, 25 Jan 2024 12:04:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60750376E0; Thu, 25 Jan 2024 12:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="dSTgrFVZ" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 048EA4501B for ; Thu, 25 Jan 2024 12:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706184291; cv=none; b=m/9GgNOrLLrX9smqkuG9nEChGOZqVoAxeAPGysljS83AFafQ+0/1oNxp/LOsyehBEfhWN013elQoyZKgoUqqQeRthPs+4ti1u1mKp6JfC65Wj3GqIV+sjwE+HsgmtNukZBsgfTggYRvfUrGvPkr6/dr9F/2riXAYzL38j6oDQCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706184291; c=relaxed/simple; bh=8sTLlfRLG1bLpm/xwyAPsioSxNa/NVfF9kum8TH3Cnk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=r4K1jAyStqo8ZWPTbW/EZwu2eh40Zai5+sR+4mBS/pR1gwczSGKTNeNoiP/XoEDOAio9Z6WgjZx4wZMBagZHdVJD4C3dnElHKzuCt4axKlU/1HO8jgxUkA4jaIRwRuOjBOk6sht75izv84K5fcJEpS/V4beVjl+foW6fXokoVRc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=dSTgrFVZ; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706184288; bh=8sTLlfRLG1bLpm/xwyAPsioSxNa/NVfF9kum8TH3Cnk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dSTgrFVZ9Mgn6xrnSplLE02RSuySI6ta/n6N5lSsDjUqu8PCR05/4WwDn+SSX54PR ZJgpm5bqzcKILySJzL62P7ZSqdsqvvifoqfRTdV3cUWNLuGvmYwnE1EAzy7yZiI8DM P7uJrhzg7fE2E/TqqrvleB4TY2Dz/8TWYPBEsqnmWvfsWAO/3utjsWpcBR3absxtp1 bEJmcRs8tKkYfGmdjm/OQtplxKA8pmSpfcf0g4KuzZW3cMmoP5Q00Vq0GuG73vzYwV pSHir30+r5Pzo1xFslRlF/4dwsL1SjaUOmkSd5pOutZiWPIOw8qPeCxyf9Pn9maKki OpAB+HS6B7Kvw== Received: from [100.109.49.129] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madrid.collaboradmins.com (Postfix) with ESMTPSA id F26E637820AF; Thu, 25 Jan 2024 12:04:44 +0000 (UTC) Message-ID: <1cf2b45f-d41b-4b2c-80c8-0b78203f4467@collabora.com> Date: Thu, 25 Jan 2024 15:04:41 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v19 30/30] drm/panfrost: Switch to generic memory shrinker To: Boris Brezillon Cc: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?UTF-8?Q?Christian_K=C3=B6nig?= , Qiang Yu , Steven Price , Emma Anholt , Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org References: <20240105184624.508603-1-dmitry.osipenko@collabora.com> <20240105184624.508603-31-dmitry.osipenko@collabora.com> <20240125104932.478fa5bd@collabora.com> Content-Language: en-US From: Dmitry Osipenko In-Reply-To: <20240125104932.478fa5bd@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/25/24 12:49, Boris Brezillon wrote: > On Fri, 5 Jan 2024 21:46:24 +0300 > Dmitry Osipenko wrote: > >> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c >> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c >> @@ -328,6 +328,7 @@ int panfrost_mmu_map(struct panfrost_gem_mapping *mapping) >> struct panfrost_device *pfdev = to_panfrost_device(obj->dev); >> struct sg_table *sgt; >> int prot = IOMMU_READ | IOMMU_WRITE; >> + int ret = 0; >> >> if (WARN_ON(mapping->active)) >> return 0; >> @@ -335,15 +336,32 @@ int panfrost_mmu_map(struct panfrost_gem_mapping *mapping) >> if (bo->noexec) >> prot |= IOMMU_NOEXEC; >> >> + if (!obj->import_attach) { >> + /* >> + * Don't allow shrinker to move pages while pages are mapped. >> + * It's fine to move pages afterwards because shrinker will >> + * take care of unmapping pages during eviction. >> + */ > > That's not exactly what this shmem_pin() is about, is it? I think it's > here to meet the drm_gem_shmem_get_pages_sgt() rule stating that pages > must be pinned while the sgt returned by drm_gem_shmem_get_pages_sgt() > is manipulated. You actually unpin the GEM just after the mmu_map_sg() > call, which means pages could very well be reclaimed while the MMU > still has a mapping referencing those physical pages. And that's fine, > because what's supposed to protect against that is the fence we > register to the GEM resv at job submission time. The comment indeed needs to be improved, thanks. s/are mapped/in process of mapping creation/ -- Best regards, Dmitry