Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp276573rdb; Mon, 18 Sep 2023 15:03:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHANyYfTQotlkyqmOlB3Ca+mu1maz9VJAeG4rualnYaqJ+URFMFO/HbFwOp8BnhyLJ4wnC9 X-Received: by 2002:a05:6a20:4423:b0:153:353e:5e39 with SMTP id ce35-20020a056a20442300b00153353e5e39mr10495717pzb.51.1695074584819; Mon, 18 Sep 2023 15:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695074584; cv=none; d=google.com; s=arc-20160816; b=k/RvB9at+rF9xNPu9QtnaTQ+dqhT8DKjdVovlF/ABjVk1tJPeb1mEC5jdlTQCe+jC8 rFJaLm6JMrF3eLF0zQbNsHiUzHWn2FZCo+nLv7Y8OaU2fZxGY8aJhCdoVdsti2TFfuKE 76AJzr5BVknmeWvTm1WKsQ0eJEb8wEOb/a67ftB7YAREsQg3u61maW1dRpUMZCc9PMOY BPsSOJCAV5IuU7/m3YhkO208CXpAutZH5fbKFvf4ZtvgEwjObN6KikwNt/9x+VI0XKxX vKUmneFBMyyyQQ2+ZnPSNIJVbmUbdW68rAiOBrxc+ekJGCURIeTsM4wvgUq/W0XqFAzb 5esw== 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:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=xTWYo+WoaURlNI3NL3Yade7LIafYcmlDYZp1Oc9StT0=; fh=JPVgeC1c+duuig0IuwJ+EuoI5uank3sKGh0afVnrkV4=; b=Vc4irAIDt25nzPSzKhkTRkgCNZL2zk4TyxBzlsr5mFcKorKAs9VaPlGNm824Dg+Gve qsNZ53u96E/1pqITBvOxv/TR9H7UZ1j/AYH3w3EQBy7x/EK6e80+r6JfUhNHhv/avBL8 ShT4qEpfuUs0PutbBcIzOwv8mb/2XRXsj2LpemIWsZymU4uHG8NJJYR0hJBJU1LYUVwT 5gFgUXyPrV/4inFbkHPTnfM6oObfj9Iom5aAQ1zTrMH0RtR7eXsqLAsFHO6Pj81ZJQCa Mp7k8BASNH/HeKrS5S1qFQuT5YX7w5FrEYRtGALxCNaNCHZ37xaOYIvccpI7SYosDp0R AdKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SXlIrtYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id dw8-20020a056a00368800b0068fbb75adedsi8718610pfb.127.2023.09.18.15.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 15:03:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SXlIrtYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id BB8DC8127264; Mon, 18 Sep 2023 15:02:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbjIRWCv (ORCPT + 99 others); Mon, 18 Sep 2023 18:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjIRWCu (ORCPT ); Mon, 18 Sep 2023 18:02:50 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9F6B91 for ; Mon, 18 Sep 2023 15:02:44 -0700 (PDT) Received: from [192.168.68.123] (unknown [177.98.21.184]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: koike) by madras.collabora.co.uk (Postfix) with ESMTPSA id 8604C660716C; Mon, 18 Sep 2023 23:02:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695074563; bh=2Eh1ZnRMxZh6W34W3r4wk+vuNL3sb0RCnb6WZGtk7/M=; h=Date:Subject:To:References:From:In-Reply-To:From; b=SXlIrtYKRF21TYijMB9mNYAljh+FXb39GWY8zC7d5HrLmq7Ec8cNZ4JduOyfD9Iyf qf5AYBre3572rIFb/hz4TiyHsplXYjtivEl5h96fNx+YiKzND1IToJYsdMJ2nyWO14 97WVVy5tddup0/1Kt8dLbVlVwNAHG1AHL2eQ9TmLgycvlwwOIG5x7N7elGIN8YLNGv stavAnUz3RtPQIAPWswWeW7rugI1IrVDPgKF+CjsqEkfirCFHyy1piCy3spVLnEQHb h0/RRz8M3Hut5sLK396MW4t4wwQwcytF1pLoYwoWXTBHySSCh/ysIsweCNEP69TPcC MywbE1fOYJQyQ== Message-ID: <2784f5e8-ebf4-a000-509e-415e14390e23@collabora.com> Date: Mon, 18 Sep 2023 19:02:33 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: drm/vkms: deadlock between dev->event_lock and timer Content-Language: en-US To: Tetsuo Handa , Maira Canal , Arthur Grillo , Rodrigo Siqueira , Melissa Wen , Haneen Mohammed , David Airlie , DRI , syzkaller@googlegroups.com, LKML , Hillf Danton , Sanan Hasanov , Thomas Gleixner , Linus Torvalds , Daniel Stone , David Heidelberg , Vignesh Raman References: <20230913110709.6684-1-hdanton@sina.com> <99d99007-8385-31df-a659-665bf50193bc@I-love.SAKURA.ne.jp> <87pm2lzsqi.ffs@tglx> <167ee2ad-6a7e-876c-f5c9-f0a227070a78@I-love.SAKURA.ne.jp> From: Helen Koike In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 18 Sep 2023 15:02:59 -0700 (PDT) On 14/09/2023 05:12, Daniel Vetter wrote: > On Thu, Sep 14, 2023 at 03:33:41PM +0900, Tetsuo Handa wrote: >> On 2023/09/14 6:08, Thomas Gleixner wrote: >>> Maybe the VKMS people need to understand locking in the first place. The >>> first thing I saw in this code is: >>> >>> static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) >>> { >>> ... >>> mutex_unlock(&output->enabled_lock); >>> >>> What? >>> >>> Unlocking a mutex in the context of a hrtimer callback is simply >>> violating all mutex locking rules. >>> >>> How has this code ever survived lock debugging without triggering a big >>> fat warning? >> >> Commit a0e6a017ab56936c ("drm/vkms: Fix race-condition between the hrtimer >> and the atomic commit") in 6.6-rc1 replaced spinlock with mutex. So we haven't >> tested with the lock debugging yet... > > Yeah that needs an immediate revert, there's not much that looks legit in > that patch. I'll chat with Maira. > > Also yes how that landed without anyone running lockdep is ... not good. I > guess we need a lockdep enabled drm ci target that runs vkms tests asap > :-) btw, I just executed a draft version of vkms targed on the ci, we do get the warning: https://gitlab.freedesktop.org/helen.fornazier/linux/-/jobs/49156305#L623 I'm just not sure if tests would fail (since it is a warning) and it has a chance to be ignored if people don't look at the logs (unless if igt already handles that). I still need to do some adjustments (it seems the tests is hanging somewhere and we got a timeout) but we should have vkms in drm ci soon. Regards, Helen > >> MaĆ­ra and Arthur, mutex_unlock() from interrupt context is not permitted. >> Please revert that patch immediately. >> I guess that a semaphore (down()/up()) could be used instead of a mutex. > > From a quick look this smells like a classic "try to use locking when you > want synchronization primitives", so semaphore here doesn't look any > better. The vkms_set_composer() function was originally for crc > generation, where it's userspace's job to make sure they wait for all the > crc they need to be generated before they shut it down again. But for > writeback the kernel must guarantee that the compositiona actually > happens, and the current function just doesn't make any such guarantees. > > Cheers, Daniel