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=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,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 2D0CEC4320A for ; Mon, 26 Jul 2021 08:09:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 EBFAB60F4A for ; Mon, 26 Jul 2021 08:09:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EBFAB60F4A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04EA26E83B; Mon, 26 Jul 2021 08:09:02 +0000 (UTC) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by gabe.freedesktop.org (Postfix) with ESMTPS id CEAA06E82E; Mon, 26 Jul 2021 08:09:00 +0000 (UTC) Received: by mail-qt1-x834.google.com with SMTP id g11so6409895qts.11; Mon, 26 Jul 2021 01:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4aGx/FBXoLt5udIXpTvietw36g/kMHAamBIfxDLEhiE=; b=Ko0e4K1xKhD72cWpHgH6ez8YKdGN0d7uAGasJRZURgIQyEGtRd3MX5401DbwNqNZbW 81AEWxMcYlFFKb0P9Edax4impLKU1xM2iYHL+Hbvgp+SA8k3uw9bNJYn9arsuodB29hr 3laNXtKuwC97MJV50cu7JOTixPMR0l7TbmnBzMZ+BhM5eeeZHjQR9JUYIXZZgHtl7n5v tlMNvIYqmAiwlnrtr2+OWjLkd5JShWiINMAPyU/cKhxqxt/chbs9NWXq/jhpo8ypEgxZ OyeEXGnzdCIlyv3KZROc6pUZOoCWbpZJq/y7egSLnhP+ZNJDpKTlokhbxHFy7HUw0x4u 7dgA== 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=4aGx/FBXoLt5udIXpTvietw36g/kMHAamBIfxDLEhiE=; b=BTGLspdc7+NFddBllghQqhaQlj8itnjjvsdm1udGXKQmBzRc+6es2yWtc7JyX6cEX1 bNy97bEpbVKIwQtyKTMXMA5irTyYv6iX4l5aS6D5s4K/LqgcRZeqCMZlbrYPy1cptLSd mLJ6pEf0TfpBigHbLgjfVMhvweHBuIX7JFp8xrqlGFcdJNUomMBE8zNcs2YQSDtVZ8HH CCYpIzyXHhKCWQa5Ex+8dToKAXdAuRkRLKf8/iwLfx4MDdxUzxM7ZQf34wKJ6VJ4oZKc QeWErS1608nw2inx5L3g2l98jKNnswfutaYP//2m/xiB2K+FjozMfdS1+148ZxBxH508 +K0A== X-Gm-Message-State: AOAM53313KFXMq7RstDSXRrttmu1Il/xOxfqPmHAU+keh313CYcZK1HB qyVkCq2aBKRObXJ+8YSMV5k9OnoVEr80l3J8Dig= X-Google-Smtp-Source: ABdhPJxplPUPqebp25YqAG0qXCQM/pRFl0TnX9eBDaRVEzBuAr1hMXGckwVGIMPUGEbFD5RL2YGRsKsE7EvjlEPT1mo= X-Received: by 2002:ac8:584c:: with SMTP id h12mr14299679qth.95.1627286939935; Mon, 26 Jul 2021 01:08:59 -0700 (PDT) MIME-Version: 1.0 References: <20210723172142.3273510-1-jason@jlekstrand.net> <20210723172142.3273510-6-jason@jlekstrand.net> In-Reply-To: <20210723172142.3273510-6-jason@jlekstrand.net> From: Matthew Auld Date: Mon, 26 Jul 2021 09:08:34 +0100 Message-ID: Subject: Re: [Intel-gfx] [PATCH 5/8] drm/i915/gem/ttm: Only call __i915_gem_object_set_pages if needed To: Jason Ekstrand Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel Graphics Development , ML dri-devel Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 23 Jul 2021 at 18:22, Jason Ekstrand wrote: > > __i915_ttm_get_pages does two things. First, it calls ttm_bo_validate() > to check the given placement and migrate the BO if needed. Then, it > updates the GEM object to match, in case the object was migrated. If > no migration occured, however, we might still have pages on the GEM > object in which case we don't need to fetch them from TTM and call > __i915_gem_object_set_pages. This hasn't been a problem before because > the primary user of __i915_ttm_get_pages is __i915_gem_object_get_pages > which only calls it if the GEM object doesn't have pages. > > However, i915_ttm_migrate also uses __i915_ttm_get_pages to do the > migration so this meant it was unsafe to call on an already populated > object. This patch checks i915_gem_object_has_pages() before trying to > __i915_gem_object_set_pages so i915_ttm_migrate is safe to call, even on > populated objects. > > Signed-off-by: Jason Ekstrand Reviewed-by: Matthew Auld 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=-5.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,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 41AD9C4338F for ; Mon, 26 Jul 2021 08:09:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 D120660F21 for ; Mon, 26 Jul 2021 08:09:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D120660F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 637D36E82E; Mon, 26 Jul 2021 08:09:01 +0000 (UTC) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by gabe.freedesktop.org (Postfix) with ESMTPS id CEAA06E82E; Mon, 26 Jul 2021 08:09:00 +0000 (UTC) Received: by mail-qt1-x834.google.com with SMTP id g11so6409895qts.11; Mon, 26 Jul 2021 01:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4aGx/FBXoLt5udIXpTvietw36g/kMHAamBIfxDLEhiE=; b=Ko0e4K1xKhD72cWpHgH6ez8YKdGN0d7uAGasJRZURgIQyEGtRd3MX5401DbwNqNZbW 81AEWxMcYlFFKb0P9Edax4impLKU1xM2iYHL+Hbvgp+SA8k3uw9bNJYn9arsuodB29hr 3laNXtKuwC97MJV50cu7JOTixPMR0l7TbmnBzMZ+BhM5eeeZHjQR9JUYIXZZgHtl7n5v tlMNvIYqmAiwlnrtr2+OWjLkd5JShWiINMAPyU/cKhxqxt/chbs9NWXq/jhpo8ypEgxZ OyeEXGnzdCIlyv3KZROc6pUZOoCWbpZJq/y7egSLnhP+ZNJDpKTlokhbxHFy7HUw0x4u 7dgA== 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=4aGx/FBXoLt5udIXpTvietw36g/kMHAamBIfxDLEhiE=; b=BTGLspdc7+NFddBllghQqhaQlj8itnjjvsdm1udGXKQmBzRc+6es2yWtc7JyX6cEX1 bNy97bEpbVKIwQtyKTMXMA5irTyYv6iX4l5aS6D5s4K/LqgcRZeqCMZlbrYPy1cptLSd mLJ6pEf0TfpBigHbLgjfVMhvweHBuIX7JFp8xrqlGFcdJNUomMBE8zNcs2YQSDtVZ8HH CCYpIzyXHhKCWQa5Ex+8dToKAXdAuRkRLKf8/iwLfx4MDdxUzxM7ZQf34wKJ6VJ4oZKc QeWErS1608nw2inx5L3g2l98jKNnswfutaYP//2m/xiB2K+FjozMfdS1+148ZxBxH508 +K0A== X-Gm-Message-State: AOAM53313KFXMq7RstDSXRrttmu1Il/xOxfqPmHAU+keh313CYcZK1HB qyVkCq2aBKRObXJ+8YSMV5k9OnoVEr80l3J8Dig= X-Google-Smtp-Source: ABdhPJxplPUPqebp25YqAG0qXCQM/pRFl0TnX9eBDaRVEzBuAr1hMXGckwVGIMPUGEbFD5RL2YGRsKsE7EvjlEPT1mo= X-Received: by 2002:ac8:584c:: with SMTP id h12mr14299679qth.95.1627286939935; Mon, 26 Jul 2021 01:08:59 -0700 (PDT) MIME-Version: 1.0 References: <20210723172142.3273510-1-jason@jlekstrand.net> <20210723172142.3273510-6-jason@jlekstrand.net> In-Reply-To: <20210723172142.3273510-6-jason@jlekstrand.net> From: Matthew Auld Date: Mon, 26 Jul 2021 09:08:34 +0100 Message-ID: To: Jason Ekstrand Subject: Re: [Intel-gfx] [PATCH 5/8] drm/i915/gem/ttm: Only call __i915_gem_object_set_pages if needed X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel Graphics Development , ML dri-devel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, 23 Jul 2021 at 18:22, Jason Ekstrand wrote: > > __i915_ttm_get_pages does two things. First, it calls ttm_bo_validate() > to check the given placement and migrate the BO if needed. Then, it > updates the GEM object to match, in case the object was migrated. If > no migration occured, however, we might still have pages on the GEM > object in which case we don't need to fetch them from TTM and call > __i915_gem_object_set_pages. This hasn't been a problem before because > the primary user of __i915_ttm_get_pages is __i915_gem_object_get_pages > which only calls it if the GEM object doesn't have pages. > > However, i915_ttm_migrate also uses __i915_ttm_get_pages to do the > migration so this meant it was unsafe to call on an already populated > object. This patch checks i915_gem_object_has_pages() before trying to > __i915_gem_object_set_pages so i915_ttm_migrate is safe to call, even on > populated objects. > > Signed-off-by: Jason Ekstrand Reviewed-by: Matthew Auld _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx