Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp715371lqt; Fri, 19 Apr 2024 08:21:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgUlrsUQsfmGZ0xWtwkIktkqswsEhl0qBPTXo78rQ768H/yyVK7hJNP7BQt49AUyV50VQGVoDU5wO2H10EJU0IndxYD06WfdvkdjHSWg== X-Google-Smtp-Source: AGHT+IE4ed/XWAK/q8A6SQ2fpgZAj8kEpflrhFT+KIm5xIyU9/91eknGYhKVXicMsadYYpS+bRMm X-Received: by 2002:a17:902:d4c9:b0:1e3:c5d0:9fb8 with SMTP id o9-20020a170902d4c900b001e3c5d09fb8mr3010567plg.42.1713540061903; Fri, 19 Apr 2024 08:21:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713540061; cv=pass; d=google.com; s=arc-20160816; b=KFJ329aGELYt5qscWw5cvp0FGH+sQrke3OaJB32Td8UgfOqXAGnFQ5rxuHp2oynsxs IExZtajbO3bnppv9Oxkf+5ZTdER7SZNf2uf6y70hFQDfJ19gkl3OLJOfNKQIOySVK+Zp F11IoDLvnVRyVBOQ3YyGb5cSYKIZg2Kg4gSwgsX5z28vk2llDfgGwcrAzR/b67em6KrO 1CF2OG09pK7bkKmJ/O7nXMZ13HRXUfwBDdgRfanNDUmCEcyqPh6HpjXnGDOWhrTjwZyJ qYFuqE87ktj7g1E64DpMVMr/EBBR8u3qB9AH6tgI74Z+Muueehq/JQ+c3NQHQaALlkh9 r+Ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:dkim-signature:dkim-signature:date; bh=v1u6M1I7hfUyhQBN/cwpO9ocGTQ1Qy4P5YzpeMaFhQk=; fh=rySpTkvy1LdorUcIUNydQdqT0wF+aeJ7/5Bp64WisA0=; b=s62pASJHJVbVkiU60NaWXDJic3R7chNyOgtRDC3TVmVbereHOOYM/WmsUz/qWsTcq7 R4SMXx5RDGAqc9uNMRLEkQOoHMSOlaXSLRidwf223OXnkV8GOWPaoxT9rkM9Cv2robLM YB2zcQSRpAYkVkXb+U5tNIyKqt3C1ECCnVXhBWqpgcAPfqc0YJyZNHk1pAcjyZ2b+/+w QDzaA3z5cEsI7NHGNvTgstbKSMzl3k6XUyfxhp8pNchyMvQLr9yq1z6h4v3PE301BXnZ hIhO7w64xElRmJoO31IeznIsQqDh0RMh4gGG+rVbc0gOuZP+4gjwpyprrvu9taSRE7F0 hB0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="xjCz/GSk"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-151659-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151659-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i17-20020a170902cf1100b001e3d3ac40c6si3481949plg.8.2024.04.19.08.21.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151659-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="xjCz/GSk"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-151659-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151659-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C3F51B22725 for ; Fri, 19 Apr 2024 15:21:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1F4C12FB36; Fri, 19 Apr 2024 15:18:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xjCz/GSk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GMFja7Ny" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ECC812F59B; Fri, 19 Apr 2024 15:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713539919; cv=none; b=qsFeXbsHBT+01ig6xLgUPNUEbLfz22SbwVCBf7n2O8iJydIB40aPV40TnPOUS1Qedb2qREmrZuquDzxNFUu2H6AF4t4RXshxHQ2AvGYpHrU4TwrjKZYRxeCRSE/p0vfrZ7uq+DXnK9GatTCQj0wpD2dsoFIfzvp2Yf7XE5EedW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713539919; c=relaxed/simple; bh=v1u6M1I7hfUyhQBN/cwpO9ocGTQ1Qy4P5YzpeMaFhQk=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rvZwHVpWsRmtnCd26TSM8ABpEz9q00EydsPlPA8JAY32P3QNdXREoSsQY4YxNBIj8LxXCPjUTbVpy6W78qiRIZdow12xnneBrJ7RvL5mUXo+Hi/vUuLN/la0eCvVm/UA+lAcHzJIij9ZEaJSy8bXlITVWCw8TSPA72KrkZY5jO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xjCz/GSk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GMFja7Ny; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 19 Apr 2024 17:18:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713539916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1u6M1I7hfUyhQBN/cwpO9ocGTQ1Qy4P5YzpeMaFhQk=; b=xjCz/GSkAs50I+QI7DCxQjyQohYIKc6gfvXM/lOOMOQ9u4NDYv4qdY0z6mGx+hROJgFmKZ 9zWABT+BP9mqJwBa9/4yjtYDKpgRik0Cv9GA8jRsyhvXHu/MKWDm8b66esCWPBv2iLgmtT +ClBiXzbUFG/aZE+faPmaO96/IJ0GxLADiEcabH9wroL7jIYAF5/fsnkaYTATpoXx5G1gu UgVOwkWp2/Iqt4SGIo5q/Y+khYcmWoOpDBOZm1LsGnQBxF6IWpUDLvaO9NHxL5ECZ/Fox7 Yx5FU8Trbb/wjAuloMMQjlBMJpWky5bQgDrrxWHMEZ7QpqqDNeF6CkxOGonjOA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713539916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1u6M1I7hfUyhQBN/cwpO9ocGTQ1Qy4P5YzpeMaFhQk=; b=GMFja7NyiVFhz0KcOQninz2/TkAOL/1k/FUec7DzdPA2AaqJJSnOAQ/5sXQ/BziLmr/ddB rUE1t7yBUbab7YDw== From: Nam Cao To: Patrik Jakobsson Cc: Harshit Mogalapalli , jayalk@intworks.biz, Daniel Vetter , deller@gmx.de, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, tiwai@suse.de, bigeasy@linutronix.de, LKML , Vegard Nossum , George Kennedy , Darren Kenny , chuansheng.liu@intel.com Subject: Re: [bug-report] task info hung problem in fb_deferred_io_work() Message-ID: <20240419171835.5f31e32d@namcao> In-Reply-To: References: <271372d6-e665-4e7f-b088-dee5f4ab341a@oracle.com> <20240418160526.3b3c385f@namcao> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2024-04-18 Patrik Jakobsson wrote: > On Thu, Apr 18, 2024 at 4:05=E2=80=AFPM Nam Cao wr= ote: > > > > On 2024-04-18 Patrik Jakobsson wrote: =20 > > > This sounds similar to the SUSE bug [1]. We fixed it by reverting [2] > > > in the SUSE kernel. The problem seems to be that flush_delayed_work() > > > kills the timer and re-queues the work but doesn't guarantee that it > > > is finished when returning. So when the device is closed, the > > > fb_deferred_io_work() function can still be queued and tries to access > > > memory that's been freed. =20 > > > > flush_delayed_work() *does* guarantee the work is finished before > > returning. =20 >=20 > Right, flush_work() does guarantee that the work is finished, but it > doesn't guarantee that the queue is idle if work has been requeued > since flush started. So fb_deferred_io_work() should be able to happen > after the device is closed. Or am I missing something? I'm confused: how is it possible for fb_deferred_io_work() to run after the device is closed? The workqueue is flushed during closing of device. If more work is queued during/after the flushing, then someone must be writing to the device during/after the closing of the device. How can that happen? Best regards, Nam > > =20 > > > Patch [2] tries to solve the problem of not throwing away pending data > > > when closing the device. Perhaps calling cancel_delayed_work_sync() > > > and then follow up with a manual call to fb_deferred_io_work() would > > > be enough to flush the remaining data? > > > > > > -Patrik > > > > > > [1] https://bugzilla.suse.com/show_bug.cgi?id=3D1221814 > > > [2] 33cd6ea9c067 fbdev: flush deferred IO before closing > > > =20 > > > > > > > > > > > > Thanks, > > > > Harshit =20 > > =20