Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3598298lfo; Mon, 23 May 2022 08:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0PFILkaCXftgOAF8dspcdi+231yVmIbUFD577OSvLjoj3zchrzOSC3iohugQkQtYJ/V1g X-Received: by 2002:a17:90b:1482:b0:1df:5b39:8a4 with SMTP id js2-20020a17090b148200b001df5b3908a4mr27664423pjb.233.1653321271831; Mon, 23 May 2022 08:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653321271; cv=none; d=google.com; s=arc-20160816; b=ZdJnb2oxuOUh9xujWjkcRgFzjsZytRokko6qeHldOLiGw2s/S9t/nnLuT82R1Ca0aR 2q6qVLrmfq789qk28FhJtjym6zMLASF4zhfXqnOxRewY5ujMP7DYEdecZv2EUG1099s2 1OyxFRi5+9LN0PU0dkLGZxWLLqPl03PT0obRAxCvTUlx0H4alNkdshnT9hnFeC9dHlw2 xuUCyBSUWDXwKa9i9X3ggtDLrB1wJ/NUzhX+lDKiF5KnN+1aSeomeqbMSRyoQlVPM4dD 63jVwY/ksG0CjJMWkceFmY+MjfDyQzOfec7cJSMhrgiReYYcO1hw81JDzCFqpuYXFHNh 1vtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=iHf5zdP+MdWZGP1j5JaUi3C5L/v74X0z3MOSo0H7TPE=; b=w/NJV/5JQgq9bgvEob3/i9Vp+NZBYoLmJhhrRP0u3D0Yq6iEyohJcSOknhe4B7HRI0 boxCHyQO0N5Ked9NRlfI5ksqJgSFQfXyAye9hJtgwgKQ341bQIqZDsFKCpqEL0J1UKgU igoNnecNNa72zBi5Xa/NLf8nK4XdrCDPxiKlBhp1nCkpujwjylRYtpa1DGoYwryzje3S h+uu/ozcRfrHaBv4MxzzOpi5uNNbs24Qx1iHmdYoWjZc/nx85uX3UnaAToKgIpR6UIkJ bX1I74RepvAzQxP2BLt26jBIn5riXX4cn4bcpQn7SKdK8ENRyitFZOiuU5DwjnDKMz0I FgWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cSl8zy7n; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 127-20020a630185000000b003fa67e3a3casi3555462pgb.784.2022.05.23.08.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 08:54:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cSl8zy7n; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9C806527F5; Mon, 23 May 2022 08:54:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238167AbiEWPx6 (ORCPT + 99 others); Mon, 23 May 2022 11:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238353AbiEWPxc (ORCPT ); Mon, 23 May 2022 11:53:32 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6101060DBD for ; Mon, 23 May 2022 08:53:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id E6C261F43999 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1653321209; bh=NzwdUWK14vQgJs3bT2nJXsIJw7vgrnGZ5jOEJKZH3V4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cSl8zy7n2eDm5whb81GyXjTw7qC/3a3Br6GIQSyiBLYqyJvRF7d9eOKpwJFYeviUw ADqBnvYJfBhejzlUu6LRy35efOpT6TOvV//6Kzju3OJ76GfFmya5ddyCUWO18LwbZE i26QQtWLmg5xFPnYdIE0o6WQegUvow1wpB/6cZo5Z06PRvC6StAfEycFD4EslPE2gF OU65WIwuNEzCmm6XtePpiKgTQMD2nbhj9956j/DwvREc69MSdNqmH7zf5l/XKYXlXM m3xvxnJ2wLtlnchWBF2OUHCpOTOeT+rpwbR29wp6BKOqnpOj/Ip2U9vU96iMBTT8of 4ow03fBArPfKg== Message-ID: Date: Mon, 23 May 2022 16:53:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 3/4] drm/i915: allow volatile buffers to use ttm pool allocator Content-Language: en-US To: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: Matthew Auld , linux-kernel@vger.kernel.org References: <20220503191316.1145124-1-bob.beckett@collabora.com> <20220503191316.1145124-4-bob.beckett@collabora.com> <3ce81c514959e43f5afd7e74489dd5b89b1cd633.camel@linux.intel.com> From: Robert Beckett In-Reply-To: <3ce81c514959e43f5afd7e74489dd5b89b1cd633.camel@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/2022 13:42, Thomas Hellström wrote: > Hi, Bob, > > On Tue, 2022-05-03 at 19:13 +0000, Robert Beckett wrote: >> internal buffers should be shmem backed. >> if a volatile buffer is requested, allow ttm to use the pool >> allocator >> to provide volatile pages as backing >> >> Signed-off-by: Robert Beckett >> --- >>  drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 3 ++- >>  1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c >> b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c >> index 4c25d9b2f138..fdb3a1c18cb6 100644 >> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c >> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c >> @@ -309,7 +309,8 @@ static struct ttm_tt *i915_ttm_tt_create(struct >> ttm_buffer_object *bo, >>                 page_flags |= TTM_TT_FLAG_ZERO_ALLOC; >> >>         caching = i915_ttm_select_tt_caching(obj); >> -       if (i915_gem_object_is_shrinkable(obj) && caching == >> ttm_cached) { >> +       if (i915_gem_object_is_shrinkable(obj) && caching == >> ttm_cached && >> +           !i915_gem_object_is_volatile(obj)) { >>                 page_flags |= TTM_TT_FLAG_EXTERNAL | >>                               TTM_TT_FLAG_EXTERNAL_MAPPABLE; >>                 i915_tt->is_shmem = true; > > While this is ok, I think it also needs adjustment in the i915_ttm > shrink callback. If someone creates a volatile smem object which then > hits the shrinker, I think we might hit asserts that it's a is_shem > ttm? > > In this case, the shrink callback should just i915_ttm_purge(). agreed. nice catch. I'll fix for v2 looks like we could maybe do with some extra shrinker testing too? looks like nothing caught this during CI testing > > /Thomas > >