From patchwork Mon May 11 09:11:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11540037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A946159A for ; Mon, 11 May 2020 09:12:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 218002495B for ; Mon, 11 May 2020 09:12:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="XSlecak9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729184AbgEKJL4 (ORCPT ); Mon, 11 May 2020 05:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727093AbgEKJLz (ORCPT ); Mon, 11 May 2020 05:11:55 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AC61C061A0C for ; Mon, 11 May 2020 02:11:55 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id w7so9929655wre.13 for ; Mon, 11 May 2020 02:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q7OJr2fNjgGIcJIqqF9ej5dw8+vyB2iSNpGREcUJdJ8=; b=XSlecak9WF0+12diZ+csclqCd6URlr2zAoK8NqOOevNyeI615JACkJ6RVjZvHhQMm/ cZGgYTHh6V8wa/pbt1dwPjKLdID/v2MfGPl4KhtWRCcVKYJfw4ylih3zuyirqJGbi73q mJOsRI5Mf796KuLVu06LlUNBFr7NHZpM8jVno= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q7OJr2fNjgGIcJIqqF9ej5dw8+vyB2iSNpGREcUJdJ8=; b=RQfvdT2KWoYcGCnpXeIzZXf4wZohLbYM6S8/0u36k9ApEB55K7Mv5VF4Ysj61Ak+xo dcseNder4tR80ovZxUgHxNzLYJaABLImLxUqD3ws+oJ9X5wsldQtobr9pqo8hsqgHmrW fEt8rUi3313bX9T4zGi4uIgIKcVnveexliIfDa/GeV44m+Z4PN2/w/WdQsS4BoEVFoq/ FPSjmJf48cNilf4XTD/uBbOIUlgojsedTTqM7/K2ae3pcZ2bI9c95fYCNuM0rz4A7+lT R/l7aZx0PwbSQAQ1u71ZZ7iUgHFTJVWX5blNSrhYqtq5wYdYsJ1MBHhMK9XtiajOt+u3 vDAQ== X-Gm-Message-State: AGi0PuYtclTM35Xn5GTYhe5s2oy9zgokTEu9lNtx/BY31FQQRq6JWhfU Ju02OEyRc/RJaVFYjYRv70m2AQ== X-Google-Smtp-Source: APiQypKTOisFnohd+WRO0Z88W2Yg66YiWX7rj46BoIw2L57BnjAgP/PH17CP0/qQS37ikw0XH2izsw== X-Received: by 2002:adf:f3cc:: with SMTP id g12mr6637314wrp.427.1589188314245; Mon, 11 May 2020 02:11:54 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id t4sm17506299wri.54.2020.05.11.02.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 02:11:53 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , Daniel Vetter , Daniel Vetter , Sumit Semwal , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH 2/3] dma-fence: use default wait function for mock fences Date: Mon, 11 May 2020 11:11:41 +0200 Message-Id: <20200511091142.208787-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200511091142.208787-1-daniel.vetter@ffwll.ch> References: <20200511091142.208787-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org No need to micro-optmize when we're waiting in a mocked object ... Signed-off-by: Daniel Vetter Cc: Sumit Semwal Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Acked-by: Michael J. Ruhl --- drivers/dma-buf/st-dma-fence.c | 41 ---------------------------------- 1 file changed, 41 deletions(-) diff --git a/drivers/dma-buf/st-dma-fence.c b/drivers/dma-buf/st-dma-fence.c index e593064341c8..8166d2984702 100644 --- a/drivers/dma-buf/st-dma-fence.c +++ b/drivers/dma-buf/st-dma-fence.c @@ -33,50 +33,9 @@ static void mock_fence_release(struct dma_fence *f) kmem_cache_free(slab_fences, to_mock_fence(f)); } -struct wait_cb { - struct dma_fence_cb cb; - struct task_struct *task; -}; - -static void mock_wakeup(struct dma_fence *f, struct dma_fence_cb *cb) -{ - wake_up_process(container_of(cb, struct wait_cb, cb)->task); -} - -static long mock_wait(struct dma_fence *f, bool intr, long timeout) -{ - const int state = intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE; - struct wait_cb cb = { .task = current }; - - if (dma_fence_add_callback(f, &cb.cb, mock_wakeup)) - return timeout; - - while (timeout) { - set_current_state(state); - - if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &f->flags)) - break; - - if (signal_pending_state(state, current)) - break; - - timeout = schedule_timeout(timeout); - } - __set_current_state(TASK_RUNNING); - - if (!dma_fence_remove_callback(f, &cb.cb)) - return timeout; - - if (signal_pending_state(state, current)) - return -ERESTARTSYS; - - return -ETIME; -} - static const struct dma_fence_ops mock_ops = { .get_driver_name = mock_name, .get_timeline_name = mock_name, - .wait = mock_wait, .release = mock_fence_release, }; From patchwork Mon May 11 09:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11540033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C07C5912 for ; Mon, 11 May 2020 09:11:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A79302098B for ; Mon, 11 May 2020 09:11:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="h4rIFRGn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729308AbgEKJL5 (ORCPT ); Mon, 11 May 2020 05:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727093AbgEKJL5 (ORCPT ); Mon, 11 May 2020 05:11:57 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8848C061A0C for ; Mon, 11 May 2020 02:11:56 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id l18so9917688wrn.6 for ; Mon, 11 May 2020 02:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0CinOkbYS8oPgPVLI49BKt2JzQLqGPZqhctItxxwelA=; b=h4rIFRGn0yKy4FgF2CPDHTuSqgim5fjp6Ly9Ueas+XY00rIljDAeF2fRgJ3GyRmMva juSun8H2JFb0tKhLNykj5s7WbdhQtMrb6yKjQ3/EG1CrxrYWGuMXykVRWcToDMvHyZWd kwRsJAkax1d6Xmna3tnM/71z6J0ExhjpOI7pA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0CinOkbYS8oPgPVLI49BKt2JzQLqGPZqhctItxxwelA=; b=i1XTPC251JQdsF3XveikvExg1MsRzDlxM3tgLuScj5x74Mx0j/c5CMtRt48KJ2MPG2 86PuKbElbpP56vr4b6l6wDGyOsPIIBmkat6Pc/ZDbENzaUzKwfHGseOHUQFovKJeFDN0 u/BNtv3a2xY69S2TQTeU2rD1b0Z1yURRUA52Ht2bSjlibfAwfP5q9+5vJPVUyDuSq8+y x+d4hpXBD2QjVgcE+Yc4iY/rH9wkIpgSF5NXgLkSsD75E9uY/phnbFmLm1VS4e9EplwM +XWViw0wPENlt8NYCjujK3Ms4//lbK+kkW2Hh+gpuc+mULG3vIRVCXgdg6AwAnPvItGl Z51A== X-Gm-Message-State: AGi0Pub8y+zFh0dbVXw4ypGWXsC/5lzpG9OH9KlEFIsWKe07opiyC5Oi a5wvtz7wKyJOFYIZ7GvocWy8/g== X-Google-Smtp-Source: APiQypIe/NcTRB7OjwoRrwiqdLysAONSgQ8XmUpqQiiFNg4nNfp3xqmACL1LU9lULCHwhJ4moMYGIg== X-Received: by 2002:adf:e582:: with SMTP id l2mr18950634wrm.392.1589188315492; Mon, 11 May 2020 02:11:55 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id t4sm17506299wri.54.2020.05.11.02.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 02:11:54 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , Daniel Vetter , Daniel Vetter , Greg Kroah-Hartman , Olof Johansson , Oded Gabbay , Sumit Semwal , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH 3/3] misc/habalabs: don't set default fence_ops->wait Date: Mon, 11 May 2020 11:11:42 +0200 Message-Id: <20200511091142.208787-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200511091142.208787-1-daniel.vetter@ffwll.ch> References: <20200511091142.208787-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org It's the default. Also so much for "we're not going to tell the graphics people how to review their code", dma_fence is a pretty core piece of gpu driver infrastructure. And it's very much uapi relevant, including piles of corresponding userspace protocols and libraries for how to pass these around. Would be great if habanalabs would not use this (from a quick look it's not needed at all), since open source the userspace and playing by the usual rules isn't on the table. If that's not possible (because it's actually using the uapi part of dma_fence to interact with gpu drivers) then we have exactly what everyone promised we'd want to avoid. Signed-off-by: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Olof Johansson Cc: Oded Gabbay Cc: Sumit Semwal Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org --- drivers/misc/habanalabs/command_submission.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/misc/habanalabs/command_submission.c b/drivers/misc/habanalabs/command_submission.c index 409276b6374d..cc3ce759b6c3 100644 --- a/drivers/misc/habanalabs/command_submission.c +++ b/drivers/misc/habanalabs/command_submission.c @@ -46,7 +46,6 @@ static const struct dma_fence_ops hl_fence_ops = { .get_driver_name = hl_fence_get_driver_name, .get_timeline_name = hl_fence_get_timeline_name, .enable_signaling = hl_fence_enable_signaling, - .wait = dma_fence_default_wait, .release = hl_fence_release };