From patchwork Thu Jun 6 22:27:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10980515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E454B14B6 for ; Thu, 6 Jun 2019 22:28:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D150A1FFE4 for ; Thu, 6 Jun 2019 22:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3E5327EE2; Thu, 6 Jun 2019 22:28:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6EBAB1FFE4 for ; Thu, 6 Jun 2019 22:28:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1323C899DB; Thu, 6 Jun 2019 22:28:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC39A899DB for ; Thu, 6 Jun 2019 22:28:01 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id c26so5581265edt.1 for ; Thu, 06 Jun 2019 15:28:01 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=2jYTwmO+POOJhTxQ1RaidZH+aZqgLhTZnC2sZyUydQc=; b=rgl1yY8hnNO2rbprWishAnEogkSZGtziLrIU3NAzN2wdmmLOYSwblTO59YTTwmP/nP gSTRNrSgTll4bSjxfcM3A9DQQLMnwKm49M8httCVqMR4pLeb1dVL+vgGSA3ZRElfk9TQ h4TeSDnJ9yDZ55l5CYzjPATMMzyUuvTayt5JMzRaCiL/XeOWkpZXYIaylRgdGllj6m9r bXWlC/8z//PzmjcytGAQ1OWU1/cusYfTX9/c3r/G+gbqlbV4KNCiMS+uR5FYmh8Zlftt BljDuombBolgp4PBjUzjMhMPBnBPXFGLXp+ERFqXuLUs5kYi+k/ZLLiyfe/tGfuelaGE IjCQ== X-Gm-Message-State: APjAAAV7FmC9KWHMHsyU66ho3H9l/OzbIssVDxOxwWsv9JBEJHkqn7XS PqRv2ytFiTMrFnIRu8bTsJmkUVezejc= X-Google-Smtp-Source: APXvYqwM1/qj7mYhHTCrO2Ta3iedpRlq1/zIefMu4FpDiu5lT4LlhRt8cv2j2hfbmuG3fiYJJV1RWA== X-Received: by 2002:a50:e612:: with SMTP id y18mr52576253edm.143.1559860079964; Thu, 06 Jun 2019 15:27:59 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id z10sm54228edl.35.2019.06.06.15.27.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 06 Jun 2019 15:27:59 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 00/10] drm/vkms: rework crc worker Date: Fri, 7 Jun 2019 00:27:41 +0200 Message-Id: <20190606222751.32567-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2jYTwmO+POOJhTxQ1RaidZH+aZqgLhTZnC2sZyUydQc=; b=Seg676epj0Ntn6V+ieat08HJl92LXuNQ0VKDdRjIjTifR1zrLNIrs6iKuZtOEgaeK5 4600K+yf9gd5ZdSIWXkn+twnbOGzgGnNSg/x6vIWCgvdg8kBxt1SbI97rpLTfcRV4m+N KClw7K5R5KMJC8yjW77VKMburlb1Z/7EQTYSQ= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi all, This here is the first part of a rework for the vkms crc worker. I think this should fix all the locking/races/use-after-free issues I spotted in the code. There's more work we can do in the future as a follow-up: - directly access vkms_plane_state->base in the crc worker, with this approach in this series here that should be safe now. Follow-up patches could switch and remove all the separate crc_data infrastructure. - I think some kerneldoc for vkms structures would be nice. Documentation the various functions is probably overkill. - Implementing a more generic blending engine, as prep for adding more pixel formats, more planes, and more features in general. Tested with kms_pipe_crc, kms_flip and kms_cursor_crc. Seems to not make things worse, but I didn't do a full run. Cheers, Daniel Daniel Vetter (10): drm/vkms: Fix crc worker races drm/vkms: Use spin_lock_irq in process context drm/vkms: Rename vkms_output.state_lock to crc_lock drm/vkms: Move format arrays to vkms_plane.c drm/vkms: Add our own commit_tail drm/vkms: flush crc workers earlier in commit flow drm/vkms: Dont flush crc worker when we change crc status drm/vkms: No _irqsave within spin_lock_irq needed drm/vkms: totally reworked crc data tracking drm/vkms: No need for ->pages_lock in crc work anymore drivers/gpu/drm/vkms/vkms_crc.c | 74 +++++++++------------------- drivers/gpu/drm/vkms/vkms_crtc.c | 80 ++++++++++++++++++++++++++----- drivers/gpu/drm/vkms/vkms_drv.c | 35 ++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.h | 24 +++++----- drivers/gpu/drm/vkms/vkms_plane.c | 8 ++++ 5 files changed, 146 insertions(+), 75 deletions(-)