From patchwork Wed May 27 14:05:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 187270 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1152084ilb; Wed, 27 May 2020 07:05:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEZpn8YNMCueLetriK7mwS4GER6RwfrE5Or5CFOEYgkiluOWUMqwn1R4WB7Jg1F2zaBdOf X-Received: by 2002:a17:90b:8d1:: with SMTP id ds17mr5063663pjb.76.1590588347981; Wed, 27 May 2020 07:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590588347; cv=none; d=google.com; s=arc-20160816; b=TZNJevHFZ8RE+LbkkFap0a9fxbryd+kJfqN6ZDVGnrtduSyh23CFbxguEdvhpDeePa VU1LsYQlTLuV9G9jQpssX429DRfZofG5zxKrc8vTXGC0VsRZgdLM9D2FGyilY8uN5iMX /3XeLObvFTW8PJiNNgFrOVsZ93xEA4JbUleF83Ba3YPUkyEhAZefW/0Aw6skVlhck3zn DDfgxNTFDstMgF1II1rxM2NJIoAvV3f6O+G95WTNjiuggwS8JqnfUjYnhFU8X/1MlBCE wRKs43u9vVqyIJgA/58q8SzXqTf8e7tO6nGcawfAjoxG4za4c4+m3kz/wE2R1JEXgRaR ZSTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=21Ka/q0wyq31JNXDbH6BdV/y1KiBtd3BwRk+w705oUI=; b=S5hEYobQ+ZqgCU7HOPPDC1O8IGyYIAEffFX1CK3G7o0UaxKrIYNET1gEfc+ozPbZpC BSCp5L1YeVQGVUtYnqmRi4nkvigS4L6uwDqyAnaUz6uIroMS4aaoy/8qxWE4TMt8+EC3 xM/Xv76qdzrPvCKQwvKQ/3RBCeCKxrnHvJbZ9+6Pno022M0it32UObhSs6psFb7j708I sY3LcZGdE3DNe+jqq685P1fVkRLqxYzC1F7jsvMrtM0s63m/y9cn8/ArgoJLR+7HHbCW eyn0R+ztnZZL75dNFIvmFPpPOgQF9Mq87cqg7Qz3c5yeucGJGeeohGtk3ggFUzQPydNE 6wMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id m67si2344880pjb.16.2020.05.27.07.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 07:05:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03D158999E; Wed, 27 May 2020 14:05:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id 24F978999E for ; Wed, 27 May 2020 14:05:44 +0000 (UTC) Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Myevl-1ioaSD1TtV-00z0dt; Wed, 27 May 2020 16:05:28 +0200 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Tvrtko Ursulin , Chris Wilson Subject: [PATCH 1/3] drm/i915/pmu: avoid an maybe-uninitialized warning Date: Wed, 27 May 2020 16:05:08 +0200 Message-Id: <20200527140526.1458215-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:iA/oVTFZbT0EcafqZRx1usz2+oWll8ShFOXyKlbH3L+E47gvF24 rqK1c0Xjr6CQW/9Sy+2v5OER+rRGSk92oqcKN3TTYYe1sGIBdezAIm9CdYAHoiZtdDxhMQI s6KkiyxtAAfHu/e/ASnv9FV7L+EgSb4wsnxyLn0niqe6JnEiNM7wwJk2MjrmrOK2vTbuPmB ObhVD+c+lb9Xai3ZpB3eA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:n4SCQDCGfV4=:ogzOYkn3538mcJo7f6pEXn KqUMsB2e549l4uTNcu0TMs57ViYWWma7nnmTkQUgk5pirC0JZJ8I9o1d/3GnQuN90omKJ8/in f6WvQv5vfh1kF6kkMNB8TdkmDJiiWWxQsD+aDh8oa7aLUvTFBopx/gGolFh67VhzpalNT4kYK 5io+ssP/9LSgE173ood5obfWLOz3uPkNzRM//eq3ImMu1sPQAhVYjU97FUs8+7HDjg3hnAnnc VGNSKc0IDaNLcFif0+39tHVzQyECePxPsAI6XrVD4DS9h2sMSEyYhb08Fx3sXMBqTdeJ8Esn0 gHAtyuS2nxpp0womDgWcqxjT8QMMMgZdhrpQudjek57HqwqYpdzsMNdZ0lL2dK1babZq2ZHBV R3RpfJr/uNRK6n12I3hSn8PVptJ1YMquHWlh5EhSwfFyJJXrV2C1jgoj+eUHixetnQHYTArum mGfEc/Szlj/C810ABru1nVLtHhIapRHTL8jZdaWyiut5bvbgvIt6ZcjP+uHnY/NAojhI0wOnY reFYaK6g0U0s52KSBorCrVz6HZtO3N3RGLFiDjRuAJOzIj9wPFxiLR/IjJeehijl1rUw9eDLD 1YLh45rAQQjojtxacOLrpj1oPPbOJU0Eb4umkPMHbVQh9wFnNGtNVKoqbuv9KyWZjFrOSOv/7 Mudl4HiW8d4AUmEwLrXvD1gCO40Vi5hhkSs/ZmEq9nYBxFyukyckpsn7q4w9jB00vOP/uZT8n CbjVviFDTK9qvvXXLv6ZHukjL2YT/aETMODlRWwbqbKN5KJFcgfoHU2msQ/UYzw8t63mesWnI 27fZW9RLueux46y0revxiSAGcH0BbUJminol69qJsIw52HXlh8= 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: Andi Shyti , Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, =?utf-8?q?Micha=C5=82_Winiarski?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Conditional spinlocks make it hard for gcc and for lockdep to follow the code flow. This one causes a warning with at least gcc-9 and higher: In file included from include/linux/irq.h:14, from drivers/gpu/drm/i915/i915_pmu.c:7: drivers/gpu/drm/i915/i915_pmu.c: In function 'i915_sample': include/linux/spinlock.h:289:3: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized] 289 | _raw_spin_unlock_irqrestore(lock, flags); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/i915_pmu.c:288:17: note: 'flags' was declared here 288 | unsigned long flags; | ^~~~~ Split out the part between the locks into a separate function for readability and to let the compiler figure out what the logic actually is. Fixes: d79e1bd676f0 ("drm/i915/pmu: Only use exclusive mmio access for gen7") Signed-off-by: Arnd Bergmann --- I have no idea why I see three separate issues like this pop up in i915, there are not a lot of them elsewhere. drivers/gpu/drm/i915/i915_pmu.c | 84 ++++++++++++++++----------------- 1 file changed, 42 insertions(+), 42 deletions(-) -- 2.26.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel Reviewed-by: Chris Wilson diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index e991a707bdb7..962ded9ce73f 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -269,12 +269,48 @@ static bool exclusive_mmio_access(const struct drm_i915_private *i915) return IS_GEN(i915, 7); } +static void engine_sample(struct intel_engine_cs *engine, unsigned int period_ns) +{ + struct intel_engine_pmu *pmu = &engine->pmu; + bool busy; + u32 val; + + val = ENGINE_READ_FW(engine, RING_CTL); + if (val == 0) /* powerwell off => engine idle */ + return; + + if (val & RING_WAIT) + add_sample(&pmu->sample[I915_SAMPLE_WAIT], period_ns); + if (val & RING_WAIT_SEMAPHORE) + add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns); + + /* No need to sample when busy stats are supported. */ + if (intel_engine_supports_stats(engine)) + return; + + /* + * While waiting on a semaphore or event, MI_MODE reports the + * ring as idle. However, previously using the seqno, and with + * execlists sampling, we account for the ring waiting as the + * engine being busy. Therefore, we record the sample as being + * busy if either waiting or !idle. + */ + busy = val & (RING_WAIT_SEMAPHORE | RING_WAIT); + if (!busy) { + val = ENGINE_READ_FW(engine, RING_MI_MODE); + busy = !(val & MODE_IDLE); + } + if (busy) + add_sample(&pmu->sample[I915_SAMPLE_BUSY], period_ns); +} + static void engines_sample(struct intel_gt *gt, unsigned int period_ns) { struct drm_i915_private *i915 = gt->i915; struct intel_engine_cs *engine; enum intel_engine_id id; + unsigned long flags; if ((i915->pmu.enable & ENGINE_SAMPLE_MASK) == 0) return; @@ -283,53 +319,17 @@ engines_sample(struct intel_gt *gt, unsigned int period_ns) return; for_each_engine(engine, gt, id) { - struct intel_engine_pmu *pmu = &engine->pmu; - spinlock_t *mmio_lock; - unsigned long flags; - bool busy; - u32 val; - if (!intel_engine_pm_get_if_awake(engine)) continue; - mmio_lock = NULL; - if (exclusive_mmio_access(i915)) - mmio_lock = &engine->uncore->lock; - - if (unlikely(mmio_lock)) - spin_lock_irqsave(mmio_lock, flags); - - val = ENGINE_READ_FW(engine, RING_CTL); - if (val == 0) /* powerwell off => engine idle */ - goto skip; - - if (val & RING_WAIT) - add_sample(&pmu->sample[I915_SAMPLE_WAIT], period_ns); - if (val & RING_WAIT_SEMAPHORE) - add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns); - - /* No need to sample when busy stats are supported. */ - if (intel_engine_supports_stats(engine)) - goto skip; - - /* - * While waiting on a semaphore or event, MI_MODE reports the - * ring as idle. However, previously using the seqno, and with - * execlists sampling, we account for the ring waiting as the - * engine being busy. Therefore, we record the sample as being - * busy if either waiting or !idle. - */ - busy = val & (RING_WAIT_SEMAPHORE | RING_WAIT); - if (!busy) { - val = ENGINE_READ_FW(engine, RING_MI_MODE); - busy = !(val & MODE_IDLE); + if (exclusive_mmio_access(i915)) { + spin_lock_irqsave(&engine->uncore->lock, flags); + engine_sample(engine, period_ns); + spin_unlock_irqrestore(&engine->uncore->lock, flags); + } else { + engine_sample(engine, period_ns); } - if (busy) - add_sample(&pmu->sample[I915_SAMPLE_BUSY], period_ns); -skip: - if (unlikely(mmio_lock)) - spin_unlock_irqrestore(mmio_lock, flags); intel_engine_pm_put_async(engine); } } From patchwork Wed May 27 14:05:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 187271 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1152163ilb; Wed, 27 May 2020 07:05:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQBe40Nez7Ap0iTvtsWZ0Aqo8yzBgITGeOKX0g+5PEq9XCXrKgDEGg0250oaTFWacw1l3+ X-Received: by 2002:a63:f304:: with SMTP id l4mr4262532pgh.235.1590588350969; Wed, 27 May 2020 07:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590588350; cv=none; d=google.com; s=arc-20160816; b=QsTr1Y2v65IORM3K61IMoEW3Q2GW7+lQRATPtO0H4Hnmch/QYOq0CSNMVZTQNmCcs3 VrHdARH5imxXkQbXRalQRwGq0K8buXQvU6wTDy0FZoLffaJYIwH0mxtmq1jgqPGbnfB+ 8A6dMGOgNsim1CyjAFwNPVcfTxxv+9tuvkhMG1YfQRLG+BKPSHYEtH4+hl+GdZxgmc1t Ef6sLLUBDWjFZRhur7/2tE4nQxejoem3ztTHVW5JaCyj2H4o0ggthKAACMrdBBWfkGbF OpE+YCymwnszZWkx0E6hqDXfkOp+feFbkUUlAnrO9HL+BnUFyWdH7n07Do9MZwGDTxD3 PhbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=+dYWe85JFloc9+h7/cLyqb3YigcX8/f1MjOoeZy2nAE=; b=TmrebqRSfKQiM60A14I3OespD7G10x0S9sY6SWWyTH4AiT49k6o6mijocmWrl/vJpJ 3GJg19v5xTbie/sfxf9+TFYniis/rgd+DBkOw4KuHcGE2888iWP2VzbIU3wAQ9onGKNd +ermogmWemlOPgDKxx1hDSZBypyKfwMoxfrDfXZMnkfoO4yrazuWUxTzwiSmxzw/53On MAMIquq8Z58YLZaogypW0x58tFUwv/rwNkTK7+1wS49k4q56lXmLjq7bK9erLv5U6y0G NO41Flsw9jKo+BkDpVgIjd8Ga/h9URlwAWUMvBCWEJX2CsEmybDLvArsBuBz48SJSJ6d YlrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o25si2439071pgc.147.2020.05.27.07.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 07:05:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F19AB899DC; Wed, 27 May 2020 14:05:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51804899DC for ; Wed, 27 May 2020 14:05:47 +0000 (UTC) Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MLiXQ-1jMHJG1tIG-00HfcC; Wed, 27 May 2020 16:05:34 +0200 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Tvrtko Ursulin , John Harrison Subject: [PATCH 2/3] drm/i915: work around false-positive maybe-uninitialized warning Date: Wed, 27 May 2020 16:05:09 +0200 Message-Id: <20200527140526.1458215-2-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527140526.1458215-1-arnd@arndb.de> References: <20200527140526.1458215-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:XhGV89xHEat1ahk9vDcOini1cTFmNy3hR/+IomNkF0dDIF4zpZG mVIweZpVkM1y3GUbDfSqkcJna53e8KALJOgJZmp7Twzav4yEeJLd9a6aGl9MuGJqv39Lm+1 UtuYJ1CEH/1ruBsaqZOgZiXbw7k0vnL6MV+C46oN8FSuiZglkpaYnFEdXhsjxXy83Lxm7fj j/oHTDzvKdfuKAtc5lVow== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:6q9GEMSIHfE=:SltPygotEWIkp2d4ogF7Xh /11yqp6Cat0DU8un95gA2KmZtYE9HHXVtHZWdKUFy8jKARI09BnD2IaSlg+gSu+qXXjECpw8O Nmssz5cvCcpTfBEv7Pg/cq/E9/ovouVQKX2MWMwY5ErZZRWmfc20gWK1T89hu+THfWJqGzOe6 CzA7LNT3yMZcHdJggP/7tfUkYqXAD1CSFsNyVug8P2XohAYxcgOIVSUFAPWO5jlaT4CViV8j/ 3+JnU9ZXvcj3AVo284Hl+LeQFkDHLgK3oyxmlqn2WekqfQwm98VFnDVy7+BMKPvN7mabLSObM O5L7RvJkLuJQ/jqervAFpQIQadbT5KmsAg/eozGNXzwF6b5TQbmSUqacFl1xkTDtbHGtRRxmD 9OlJxUwEUprL7JYG+SPKYYtESmYyJBpl2gwRGZbrEsK+sglA3RT5UBg7JjcTLSFJoQ1keu5fd bmkQgC54zI0YVmzI2wTKO/WhGLYvD/sgEe0FchAyRtG5TmxCwg1750u88DoGWLJt+d4IlGvXI 4Mc5eM6xRxA7FWg/7nKQHN91Y60RdBMuBEJL4Fn4pLRc7e87OE2gcRg49T1zA7hGhfoAWNNne IHZs7ga+SUKRamSlNHYzv3X+PwqrpO95LlHdYUZdGZoRYsLjygLNFSwZ8awuZ/wjRWasrPX22 XntKSboFHKLVVtGycIjfMi6oiWKOUr/u+gNXpcCHIGIJbg+KkSg08qHassdnEP5BWJeFPfR/i 0TJrW0I6oAV8Rg1e4jyE26Q+iP61WXH4YquhmXgh0hIyx5YpSDYXTZQyVgs5DgqZjuZC0Fl5o 7OoEUiu1SKQ7zRG7QhhQL0dEeqyQ6EKyJ++8ntVMyzszopcOLc= 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: dri-devel@lists.freedesktop.org, Arnd Bergmann , Mika Kuoppala , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Chris Wilson , Daniele Ceraolo Spurio , Matthew Auld , "Robert M. Fosha" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" gcc-9 gets confused by the code flow in check_dirty_whitelist: drivers/gpu/drm/i915/gt/selftest_workarounds.c: In function 'check_dirty_whitelist': drivers/gpu/drm/i915/gt/selftest_workarounds.c:492:17: error: 'rsvd' may be used uninitialized in this function [-Werror=maybe-uninitialized] I could not figure out a good way to do this in a way that gcc understands better, so initialize the variable to zero, as last resort. Fixes: aee20aaed887 ("drm/i915: Implement read-only support in whitelist selftest") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/gt/selftest_workarounds.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.26.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel Reviewed-by: Chris Wilson diff --git a/drivers/gpu/drm/i915/gt/selftest_workarounds.c b/drivers/gpu/drm/i915/gt/selftest_workarounds.c index 5ed323254ee1..32785463ec9e 100644 --- a/drivers/gpu/drm/i915/gt/selftest_workarounds.c +++ b/drivers/gpu/drm/i915/gt/selftest_workarounds.c @@ -623,6 +623,8 @@ static int check_dirty_whitelist(struct intel_context *ce) err = -EINVAL; goto out_unpin; } + } else { + rsvd = 0; } expect = results[0]; From patchwork Wed May 27 14:05:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 187272 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1152329ilb; Wed, 27 May 2020 07:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy75ivZNubfysQikiAIWmxhDmh3/ieUrGejf8yyQaIjXvlmYM908eNPBmPnERkMXb1l85PE X-Received: by 2002:a17:90a:9749:: with SMTP id i9mr4846066pjw.116.1590588360186; Wed, 27 May 2020 07:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590588360; cv=none; d=google.com; s=arc-20160816; b=rHYzPm/6IIDMG2CLzOpL0pXLxm4imZFl2cCIbhSDNCpmJkCEChL8aRGowC16ViIl6t UVIGzDdLj1oeorm2fH21FkHED6gTfZGo3AAW6u2T46WxZypxxPOESdtfm5nJGxLmw/ee 3rK7EBpGdGCu6CSIBg5hTB19YCdJOg49OHnc8kxVDarUdZ35Flu5/HSQPOJY7EF6v+uG sMvkxGh0Xbhj08SCJWe1J7ponligBFW05ZhmxBzzRXk340iy67Ki12kZWtzzJyZL2PWL fytfH4Et8vdQnSo62sIWC1tJ9Sn/QVXrxJSPaADeliDcrmYVWMD193/QsW0DyVxUC9kn hShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=pcSbvZDGCTKQuWndJf1xW4CKPwCtLrsw2tJIDtBYGt8=; b=toQoIy2rgJ3EHlucJtAfUlinBEmQ9RM+fUZC44Pw0JCOKcUWx2kp7PooEOR1JOvbfg BiFpzdClAlhx0wcL2F0yGQ/ocLbLkzItSf7oTEGj3EA5A87DIIw2qgAGWoyzw8kg5mRR cQOoU44shiT6C8nDgYzbiWO1mITbr52maCJ8ecJe8NreKGsg5dh87ReYYLz7YYAk1R+K /opM4RF+eVkyFMJ6WtoX+SqgHvGQGoD1Q4uqye5SsxHooAdG8O5xBihmqcxCuxQZMDOd dZucmmdIwig/iKof2SvYquf1UBXNMet8IvUvGIksszwVbTBFKXAIHWKTt1X9NSjdFbJI sAhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id x10si2391442plv.91.2020.05.27.07.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 07:06:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F24B289A20; Wed, 27 May 2020 14:05:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12EC189A1F for ; Wed, 27 May 2020 14:05:56 +0000 (UTC) Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mo6WJ-1jFYx33Vox-00pcRT; Wed, 27 May 2020 16:05:42 +0200 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Mika Kuoppala , Chris Wilson Subject: [PATCH 3/3] drm/i915/selftests: avoid bogus maybe-uninitialized warning Date: Wed, 27 May 2020 16:05:10 +0200 Message-Id: <20200527140526.1458215-3-arnd@arndb.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527140526.1458215-1-arnd@arndb.de> References: <20200527140526.1458215-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Bs1kH9SiEUr82+i0D5b4IjNzyMWhRc9ReAI4hRbtaSg+wd4Y+kE gsHtJL0netn243C7nHQamvh/2VpFFj/mbWQZYBUlmk15Ur8+KyRpRLNWTSOpnSXrG6ACa8Y a50vkShJOWxV4ykm7XUMk0pidxZYJm1W5/Zw9bnILBSY8qbgoV8/N+o6gDRiA7eO91pvrsn zFA51RKJXl5UhRluoBa/w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:+3169tARU2k=:uC5t2mXS/rarwbKpJ4p1IL TkcNg5L4b0eQa1dnkKmj9R/sSkzpoRvOHXS4my5yaaC5Ipgn4d1MzqW671izesykz8iby4m+5 z1IvD+l5KijKgQE7VVqp37PdP1Z8kyBPIudjh8SOJe9IwGRQxJn23IKziQzSrbGAOabL33Rqj UC9ZjpLC9GhatIlmPNENyXJDcfdNAmC8jVR75LlmscyCeIQgmKczM8/5DrTdldpueq8wUOTyz JV72tDCgqyNcaDaert16Y0sw3l/yCWMETugA/v0l5p8yJzjYFsworrldztzOG9TwwtVECsezT Tyx7TQTlKGfirXDvwAFcG5DItmsJw3HVXeTdStNblLhTBLKsOQg9tXZYYJH3LMxOlzLovL0pt X4NQgpyhSnJRfCn4ZnC6jt0nte5GJ/7rVDPvPpyNFlqKDZ4tZ7ODiRKv7v2S3TiZ7h/9axGxz 9/rAxDSK75RmKxgRZFX/z93DUKLmUODUq+S//87z6aF6npDlxOEM5RmRFnCv6S3uA20KZP1DG exucUvsLOIrOHJz/b0WA3dI4HoqagLbzF4yIpfoAwfKFe2zu1nlXPeMEVu8nmUw2wSK+Mfbne HKWAq152YlnhozAc2jzA2OqZk28FYLTob4ZEMpqiy2XClWwByz/Wlq/nyHi4i/k8x/3TqZJpQ OSkAS/+T+5Vq4WASVKIzNKWyiaw9J5BL5wPMTejvRY1jag3b1jmhTWmVMcEkiMBG6fhbr7ysx pzkkkkZx0UDRaWqZpEwWJKveoIG9zxc9XE8ju3hQuslsSe94To3JlK2xF+KNjaL6ne+vqnBSB bUYPQNyOqcNk6d8FiJRHXwa+NGAXkcy95rnATkLAbrJtAtHBPE= 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: Andi Shyti , Arnd Bergmann , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matthew Auld Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" gcc has a problem following values through IS_ERR/PTR_ERR macros, leading to a false-positive warning in allmodconfig, with any compiler version: In file included from drivers/gpu/drm/i915/gt/intel_lrc.c:5892: drivers/gpu/drm/i915/gt/selftest_lrc.c: In function 'create_gpr_client.isra.0': drivers/gpu/drm/i915/gt/selftest_lrc.c:2902:23: error: 'rq' may be used uninitialized in this function [-Werror=maybe-uninitialized] This one is hard to avoid without impairing readability or adding a bugus NULL pointer. Fixes: c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/gt/selftest_lrc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) -- 2.26.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c index 824f99c4cc7c..933c3f5adf0a 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -2908,23 +2908,25 @@ create_gpr_client(struct intel_engine_cs *engine, vma = i915_vma_instance(global->obj, ce->vm, NULL); if (IS_ERR(vma)) { - err = PTR_ERR(vma); + rq = ERR_CAST(vma); goto out_ce; } err = i915_vma_pin(vma, 0, 0, PIN_USER); - if (err) + if (err) { + rq = ERR_PTR(err); goto out_ce; + } batch = create_gpr_user(engine, vma, offset); if (IS_ERR(batch)) { - err = PTR_ERR(batch); + rq = ERR_CAST(batch); goto out_vma; } rq = intel_context_create_request(ce); if (IS_ERR(rq)) { - err = PTR_ERR(rq); + rq = ERR_CAST(rq); goto out_batch; } @@ -2946,17 +2948,20 @@ create_gpr_client(struct intel_engine_cs *engine, i915_vma_unlock(batch); i915_vma_unpin(batch); - if (!err) + if (!err) { i915_request_get(rq); - i915_request_add(rq); - + i915_request_add(rq); + } else { + i915_request_add(rq); + rq = ERR_PTR(err); + } out_batch: i915_vma_put(batch); out_vma: i915_vma_unpin(vma); out_ce: intel_context_put(ce); - return err ? ERR_PTR(err) : rq; + return rq; } static int preempt_user(struct intel_engine_cs *engine,