From patchwork Sat Jan 21 19:24:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 46876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp867148wrn; Sat, 21 Jan 2023 12:19:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1/+JV3KBFh8a1fU4Lh6is1IjA1Ca0ZlwJ3LS8C675XPMMOxH2ZkEcXNBLnnAwhBoDTXjY X-Received: by 2002:a05:6a20:ba92:b0:b8:c300:c813 with SMTP id fb18-20020a056a20ba9200b000b8c300c813mr19106530pzb.12.1674332344999; Sat, 21 Jan 2023 12:19:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674332344; cv=none; d=google.com; s=arc-20160816; b=w34FHhPtTo4nFNcs228nP/hLahw3AnWecWsQk6fFX7B8HGkne1Awvy1N38C4/U3IMh bvP9IO2cL1cGXHwR0hWxsrGdzgJHxEpr+US8fscwQie5Tjw7BnqEgWfCCpgqLv9DJjNe LGcaHhIeLCVcdFbt0fgaHtI2tVc8OQavLw0/zswUXNWlh8gET/CLBGSeOj0CNKtYYmp8 jNETuoEqySyI3h+I+dksg3SJ0jQWSCnVHVQJk7MS0IK+XSP6yL7Q+SAIvHNN2s46Pjbq 0nAhi4vrnPWOadg8rCza0nVRdI2SqUdv8z2pD0FGdD0tCKC14uGVUHdmRjvlkO99Qjrl 4zFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5yb3FH8jX0MWRXyzAKd1yTC1HwTjMT1KOtJHzdpTmLM=; b=kvHUNxfaF19y+zcvs8Q+ANJ6roP3/+CMMY8r/mt87RsBgy7hIqnnnN8jkJvF/rZKXh ixh5N5Zd/vtDhgK37LNtFcad4sNkXtFSsGf1LzDfaQyYuKubPBOfqIGhuHY1Gtk/7iXr TgvoBYdzdT7lANwKatvw7+al+yJC7HCvf0RWNgooJYnHCiU9mvTCF4YIOFvNG/jo+eCH 5f4EsqiOJsbLaMmFs2OxDeoLzbuSm9GtA6OV3UyEh59qpEsG4dHh3/Zq3v3cZpFDVhFZ 9wjBdpC4NYRQdzJHZ+JjAw/Q5BxWTj1VKcmAmI4f8M0Vdh5J2VI6QqresCGsY/XuvEmp X7EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JoSuW22k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 193-20020a6300ca000000b004ccbc54e8bcsi20924391pga.93.2023.01.21.12.18.52; Sat, 21 Jan 2023 12:19:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JoSuW22k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbjAUT02 (ORCPT + 99 others); Sat, 21 Jan 2023 14:26:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbjAUT0S (ORCPT ); Sat, 21 Jan 2023 14:26:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 128FC2B2B5 for ; Sat, 21 Jan 2023 11:25:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674329088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5yb3FH8jX0MWRXyzAKd1yTC1HwTjMT1KOtJHzdpTmLM=; b=JoSuW22kD4TqqlrfuHNe42PBpjKHYTsC1g9ogMSXkOL6chSmXJuGZ8XYBNsyBPNrWiBJbT 0XbURgn32N0X58rZpypWRPxu9EyDUG78ZYWwyoU5hq8Fio5x9gNZVufHPcc/YT9FEuqbI/ Bte3HR08zhhdT1+7wrPcpiDMrpGv6M8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-297-0zzZs3foPFiJxjq4tFfQ7A-1; Sat, 21 Jan 2023 14:24:47 -0500 X-MC-Unique: 0zzZs3foPFiJxjq4tFfQ7A-1 Received: by mail-wr1-f69.google.com with SMTP id t4-20020adfe444000000b002be53a83610so916248wrm.15 for ; Sat, 21 Jan 2023 11:24:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5yb3FH8jX0MWRXyzAKd1yTC1HwTjMT1KOtJHzdpTmLM=; b=cOnKW5G1hD18xspsz8iMctQ4tJySQ5uspRzfrw8SrVbbF6yAdtO2dFmsPxLX6SQEpA GPVhE10A+TELnmcJEgFkhTszRGXjTnBgOXnX8gy/uQtDiQJuOIfvzERiYRsXexvlFvfX Z3ocF6SMlfpzUOR/JPGZTwjO4hk2qbkgd1J4MaQS44Lt7h8lflENmoj5TucCgnBJA8jH srYySI2Gy9DrDecsSmWtrXM4I6iwTmhF0pUpN/BmoToMndKXd35hKGv+sIORcQELlRsO qCvKVk0VlnRUIjUaehVmnzQl+Gc0QEvh8XE4FedDDP5vnlsp/oRd0ZWjEjJtgTKJn/Yo DsUg== X-Gm-Message-State: AFqh2krc80rNzyUUqS1cUrck4ekuK7Y+OjSXf8hgjJhD/m2/UHmlw/Hg 2y8B5qQrBycZ2thBaJkXD9Too5GxKAC5GKSOlV5WsPvP8ha3RWf1owhX5ODAmlOOv0RRnddIcuy Z+rOpFjynbzf6Qg6dEntA9xIWGc5ZndYJdkLzLYl59gtwoDkIgzM84aIpnxRMSofxPsn5oBIsKv Y= X-Received: by 2002:a05:600c:2255:b0:3da:f950:8168 with SMTP id a21-20020a05600c225500b003daf9508168mr17593307wmm.35.1674329085986; Sat, 21 Jan 2023 11:24:45 -0800 (PST) X-Received: by 2002:a05:600c:2255:b0:3da:f950:8168 with SMTP id a21-20020a05600c225500b003daf9508168mr17593290wmm.35.1674329085743; Sat, 21 Jan 2023 11:24:45 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id f14-20020a05600c154e00b003daff80f16esm8544321wmg.27.2023.01.21.11.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 11:24:45 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Thomas Zimmermann , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Maxime Ripard , Javier Martinez Canillas , Daniel Vetter , Helge Deller , Jaya Kumar , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH v2 1/3] fbdev: Remove unused struct fb_deferred_io .first_io field Date: Sat, 21 Jan 2023 20:24:16 +0100 Message-Id: <20230121192418.2814955-2-javierm@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121192418.2814955-1-javierm@redhat.com> References: <20230121192418.2814955-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755664712854663235?= X-GMAIL-MSGID: =?utf-8?q?1755664712854663235?= This optional callback was added in the commit 1f45f9dbb392 ("fb_defio: add first_io callback") but it was never used by a driver. Let's remove it since it's unlikely that will be used after a decade that was added. Signed-off-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann --- (no changes since v1) drivers/video/fbdev/core/fb_defio.c | 4 ---- include/linux/fb.h | 1 - 2 files changed, 5 deletions(-) diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c index c730253ab85c..1b680742b7f3 100644 --- a/drivers/video/fbdev/core/fb_defio.c +++ b/drivers/video/fbdev/core/fb_defio.c @@ -157,10 +157,6 @@ static vm_fault_t fb_deferred_io_track_page(struct fb_info *info, unsigned long /* protect against the workqueue changing the page list */ mutex_lock(&fbdefio->lock); - /* first write in this cycle, notify the driver */ - if (fbdefio->first_io && list_empty(&fbdefio->pagereflist)) - fbdefio->first_io(info); - pageref = fb_deferred_io_pageref_get(info, offset, page); if (WARN_ON_ONCE(!pageref)) { ret = VM_FAULT_OOM; diff --git a/include/linux/fb.h b/include/linux/fb.h index 30183fd259ae..daf336385613 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -215,7 +215,6 @@ struct fb_deferred_io { struct mutex lock; /* mutex that protects the pageref list */ struct list_head pagereflist; /* list of pagerefs for touched pages */ /* callback */ - void (*first_io)(struct fb_info *info); void (*deferred_io)(struct fb_info *info, struct list_head *pagelist); }; #endif From patchwork Sat Jan 21 19:24:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 46875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp853144wrn; Sat, 21 Jan 2023 11:28:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXtbSrazT0Au6TkiKOxEHHlZomYjgTmAjVPzGwcUdcj8vUw7sr2Bx9d3BKdTz+Z/9mmshij6 X-Received: by 2002:a17:903:2611:b0:194:cd07:a8ba with SMTP id jd17-20020a170903261100b00194cd07a8bamr10221987plb.32.1674329307214; Sat, 21 Jan 2023 11:28:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674329307; cv=none; d=google.com; s=arc-20160816; b=lwJwG0XKjWftyswpFFH43B6IDt58ojDE909WdCSZE1iNIkzHMnTshhoLLY0eJDM7kH nMJlBPH1oHAhEHAZq7molCW2J81PEu5s7CykM69+xeGrGtTEPqj+LYZuOloj0wcb1OwX rZBz8Ozip4sbQiDphQYS717ZzUMgw2dxdRfVK1oKwKMWp5UpOXF6vWizM94gXp5u6xKv ti8UWrCbwi2e2I6MyfTWY0uORkxaToFxVtMrN+PLAZwdt9cLIvVCuqBy1IuDwv7C17F7 xgKocDIXtD7yzXhlrpz22HcxStHnhzjBpR2K3DADkrW1LWPPpibUXg+1wXAxCtP2fFDq gN3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7oGQt8CSMw4GzppBRa4wPVT549mMixHHzNT+6I/9DSU=; b=1Cn2WneXxLRiJuBWP53AWRqSwjPvp8S4oEtWkbxjCKjdyuuefqnE3B24sGqYH1+n/o geWMbfDy32UScwuVjwe9aYKzgLJakJT4BEWxqc8DghV0q3goKC64i5DCj9XIcoZlpBke ORPyWy8nO2ZYSTpg577QuXe1InGy/rYIhiOfiMrNXWmV/PknCXeQIcj6Q0OMMXxBX3zm uVfylFf1fY0lrkZ4KnRXltqfE54usIku+M4SKEV1wjEhprpuI1TaNT3plnGvnz9SigSV QcA1anj6cPYfkauvwRcxrbS/Ydlkizhb6fkIcSzxD2PZLfIpGUFgjjTJL7TgcqAr4XQm Zo7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Z/VPGsVC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a170902d14100b00192a363c32bsi41783979plt.571.2023.01.21.11.28.15; Sat, 21 Jan 2023 11:28:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Z/VPGsVC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbjAUT0W (ORCPT + 99 others); Sat, 21 Jan 2023 14:26:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjAUT0R (ORCPT ); Sat, 21 Jan 2023 14:26:17 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F9DD2A161 for ; Sat, 21 Jan 2023 11:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674329089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7oGQt8CSMw4GzppBRa4wPVT549mMixHHzNT+6I/9DSU=; b=Z/VPGsVC5C/AdxQdFF/5dER3gWMBVU70XT6JwuDKHIgo6BX27x2W1h9HUb9K+1jwjk9ujn dRpgnb/iegJ9utMZvYgsanSjzF4Xhrje3gsejLqASvbXohFK19rXDsmmOH55v1PpDJwJK7 I0xYFJ3Kp2uASmCcEsShUvQKGv0NOU4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-471-8E-b9dHXMRScImc2FIZbfw-1; Sat, 21 Jan 2023 14:24:48 -0500 X-MC-Unique: 8E-b9dHXMRScImc2FIZbfw-1 Received: by mail-wr1-f72.google.com with SMTP id v20-20020adfc5d4000000b002bdfcdb4c51so1410342wrg.9 for ; Sat, 21 Jan 2023 11:24:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7oGQt8CSMw4GzppBRa4wPVT549mMixHHzNT+6I/9DSU=; b=L22jn+erI15/9Uk2xhqwNAfw3kNqjzcmdPcE/9fBBGF5YmgBUkwrZLoKTPstbLQBp3 e8HzRPEVW+8bwMT5ej3BdbXjj9MQZCEQPwAVJuxyQIr0u0ecLoIn0cE+Ult356Mbr+RU Sn3hfcTIMdU16dKlHTjDMB321qPUHl8HtgCAZLf8StY099BlO4kpQe1rw0hK0W5h6eK+ YYKA43mAPNZFv/P9VVOgYAYDAvdIFeqBnJZu5THvOCkgdSRzp6Ib03XSqPQkMfhj1gca OpU9sGRvKPxLaq0upEW65JeNPtnEJmumS4XxeEyevpq9pn4F2Tu/GLLE4jt+ELiAKMIH OUew== X-Gm-Message-State: AFqh2kqkN3Kf2HukbS+937ncBj3cLFW7OPNqKoctO3bGCNgrZhDnpxdd oJ9UA/Gbq34jUxj4L5Mx8zYwZORzxKXex+7YZAlLPhhBZpN76OuJayIWnZ3sX2knglZQb1ZM4mr S+SCyqcv43TnnOY/kIUaONBXKy4+AaTNqhEhH87/PND695yqKZUgy4/yciNZvppKPEBxBo+mUy0 w= X-Received: by 2002:a05:600c:1c23:b0:3db:b9f:f2e with SMTP id j35-20020a05600c1c2300b003db0b9f0f2emr16681542wms.14.1674329087186; Sat, 21 Jan 2023 11:24:47 -0800 (PST) X-Received: by 2002:a05:600c:1c23:b0:3db:b9f:f2e with SMTP id j35-20020a05600c1c2300b003db0b9f0f2emr16681525wms.14.1674329086970; Sat, 21 Jan 2023 11:24:46 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id f14-20020a05600c154e00b003daff80f16esm8544321wmg.27.2023.01.21.11.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 11:24:46 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Thomas Zimmermann , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Maxime Ripard , Javier Martinez Canillas , Daniel Vetter , David Airlie , Maarten Lankhorst , dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/3] drm/fb-helper: Check fb_deferred_io_init() return value Date: Sat, 21 Jan 2023 20:24:17 +0100 Message-Id: <20230121192418.2814955-3-javierm@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121192418.2814955-1-javierm@redhat.com> References: <20230121192418.2814955-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755661527870258524?= X-GMAIL-MSGID: =?utf-8?q?1755661527870258524?= The fb_deferred_io_init() can fail and return an errno code but currently there is no check for its return value. Fix that and propagate to errno to the caller in the case of a failure. Fixes: d536540f304c ("drm/fb-helper: Add generic fbdev emulation .fb_probe function") Signed-off-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann --- (no changes since v1) drivers/gpu/drm/drm_fbdev_generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c index 0a4c160e0e58..b2df8c03594c 100644 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@ -223,7 +223,9 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper, fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; fbi->fbdefio = &drm_fbdev_defio; - fb_deferred_io_init(fbi); + ret = fb_deferred_io_init(fbi); + if (ret) + return ret; } else { /* buffer is mapped for HW framebuffer */ ret = drm_client_buffer_vmap(fb_helper->buffer, &map); From patchwork Sat Jan 21 19:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 46874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp853102wrn; Sat, 21 Jan 2023 11:28:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXtdix3p+aaUWH2OF+S4Yd/RKJEjCgCe3LJMS1D73MKCMbc+6mDmQlCHPYzovGHNvb9r6W+N X-Received: by 2002:a17:90a:7347:b0:226:b52e:f1b8 with SMTP id j7-20020a17090a734700b00226b52ef1b8mr20262512pjs.24.1674329297111; Sat, 21 Jan 2023 11:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674329297; cv=none; d=google.com; s=arc-20160816; b=ERfNQxUToJaY6wS8qqHnKGWiUBn9WcmWDRy5FCbAO6ThCwoauhQD8X716FQQX627qI pVOzC8O51npLoJeLNIQfv3f75ukfhSJocdkJ6obZdzDxBvkAV8pw5i3kDaQrzdt84EoD 7MbWii91e7EIB67Ei+Cm2gZXC/nzI5pi+2nf2tribirZbsfnzLRRv/xMh0GlavzpW5mi vlrixgT6IUWDteg906HUg5sluJS7IgiqmfFLjoUW8nIp8bY0NCi14pPpyXrNR5vu7Suu bDbKegjIPxgU3uR3o66HGDQOpoAKCE7b2HGa9KcWllj8AjfJHzJrqU0jGLWIcrZ/LRxZ N6IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=INOBbY8qYhywRYADqD7lShWma79A4nWuRgcVD0ZUPcY=; b=zrm9fyYLIHuvr1KbXmeG1kBy2P1lxMglGK2rFaoiLgB05aLoZoGsFCSzj2Sjzb5WKf iSkbGYEbHQoBohfQVQ98DimJsfuMkACSPpyTPRljVg7gfA8v8H69FTxHz18noJen7Nmg k268uI2q0ocIDHJNhlf+MQRr5eYsdgVfTurAghUVE1WtsE0M3c8xSEEFCn9V4FO8Dbqc KDonDgXLsMy0Z27/dHnq9FlgSKbaArUTnd0v1nWYHZ64Opj0OLHA9PWPklS3k236q7eA OUBnfXzE313eVOX8okNeoiXAF4QAI2nUMmJYPsupR48DQblYkdZqhsma8qe2e9D8yCJd tizw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dmKJNqLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a63230e000000b0046ec3bd90bbsi46331353pgj.60.2023.01.21.11.28.04; Sat, 21 Jan 2023 11:28:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dmKJNqLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbjAUT0Z (ORCPT + 99 others); Sat, 21 Jan 2023 14:26:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229972AbjAUT0S (ORCPT ); Sat, 21 Jan 2023 14:26:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AB672B63E for ; Sat, 21 Jan 2023 11:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674329091; 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=INOBbY8qYhywRYADqD7lShWma79A4nWuRgcVD0ZUPcY=; b=dmKJNqLpqdgzd1WLC8KJNUYQ+BvLtsuFfzI+4u8u3UKqF8leVxT1pofpiSVHTDCmQgfpBD C5a1zCigVoD/7H4CL+zCVhQiNfIyKqBalQ1nKcaKNEKVbEoCZkXoe4IVh9wUL/xH6IWgX4 j2bTyjtYduiLdl6e2PEUytrzaGqVYf0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-516-Pf01lwsuNyqaJ3EbWafvdQ-1; Sat, 21 Jan 2023 14:24:50 -0500 X-MC-Unique: Pf01lwsuNyqaJ3EbWafvdQ-1 Received: by mail-wr1-f70.google.com with SMTP id h21-20020adfaa95000000b002be47d1d79cso1339293wrc.5 for ; Sat, 21 Jan 2023 11:24:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=INOBbY8qYhywRYADqD7lShWma79A4nWuRgcVD0ZUPcY=; b=PMKF1XkJ/szzSClV8WhS0voLStmIa8VdKHD0eqtWaDymRtaKA3k53DQErxgsGtvtWf A+POcx7xAxJ3d+44VyEL4Ro8NRMRsAlsoPhaKWUyiijiAh7LjDYWoVnldpQiSSQeApi+ BMlr4snvIjyjSLV5asi1PBbRwRzZpTlN22zUVWTgkrHuDl+m2NRrRhCYMA6OlTgGO76p /NM0KDn0is4vCZ4RpUus3NBOMg3ubDcE7oiyxXHl6ATBoj3B21gVCFmMelcYXKq+5iUW K5tdswBQO4Z/M2z+2tH+FysanjWrje76g4BZeAu3JEEXk/Gz3aWfIlico3SqEJqWsaeQ RjRA== X-Gm-Message-State: AFqh2krhb+i6rV2+caP2CJCQuebBlnLiMgaRtes4La65D/L6wffbKDyy iBa5vKO8N6esuJ36LKNnm0x1M2VGx8wUYNckDWEGvLoNTh+s1XP2R/N0fkoh1K13qu2zLuw/Bkb Fbi/KldE12FdpcLQ8zmyb6WynGGs94YzA7lTJ7BdlA+9LhzYy2iENjDRQbIV7OtFkS9V35yX7rS Q= X-Received: by 2002:a05:600c:54d0:b0:3da:f9c9:cec9 with SMTP id iw16-20020a05600c54d000b003daf9c9cec9mr18418295wmb.1.1674329088633; Sat, 21 Jan 2023 11:24:48 -0800 (PST) X-Received: by 2002:a05:600c:54d0:b0:3da:f9c9:cec9 with SMTP id iw16-20020a05600c54d000b003daf9c9cec9mr18418274wmb.1.1674329088340; Sat, 21 Jan 2023 11:24:48 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id f14-20020a05600c154e00b003daff80f16esm8544321wmg.27.2023.01.21.11.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 11:24:48 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Thomas Zimmermann , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Maxime Ripard , Javier Martinez Canillas , Daniel Vetter , David Airlie , Maarten Lankhorst , dri-devel@lists.freedesktop.org Subject: [PATCH v2 3/3] drm/fb-helper: Use a per-driver FB deferred I/O handler Date: Sat, 21 Jan 2023 20:24:18 +0100 Message-Id: <20230121192418.2814955-4-javierm@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121192418.2814955-1-javierm@redhat.com> References: <20230121192418.2814955-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755661517007091946?= X-GMAIL-MSGID: =?utf-8?q?1755661517007091946?= The DRM fbdev emulation layer sets the struct fb_info .fbdefio field to a struct fb_deferred_io pointer, that is shared across all drivers that use the generic drm_fbdev_generic_setup() helper function. It is a problem because the fbdev core deferred I/O logic assumes that the struct fb_deferred_io data is not shared between devices, and it's stored there state such as the list of pages touched and a mutex that is use to synchronize between the fb_deferred_io_track_page() function that track the dirty pages and fb_deferred_io_work() workqueue handler doing the actual deferred I/O. The latter can lead to the following error, since it may happen that two drivers are probed and then one is removed, which causes the mutex bo be destroyed and not existing anymore by the time the other driver tries to grab it for the fbdev deferred I/O logic: [ 369.756553] ------------[ cut here ]------------ [ 369.756604] DEBUG_LOCKS_WARN_ON(lock->magic != lock) [ 369.756631] WARNING: CPU: 2 PID: 1023 at kernel/locking/mutex.c:582 __mutex_lock+0x348/0x424 [ 369.756744] Modules linked in: nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ip v6 nf_defrag_ipv4 ip_set nf_tables nfnetlink qrtr btsdio bluetooth sunrpc brcmfmac snd_soc_hdmi_codec cpufreq_dt cfg80211 vfat fat vc4 rfkill brcmutil raspberrypi_cpufreq i2c_bcm2835 iproc_rng200 bcm2711_thermal snd_soc_core snd_pcm_dmaen gine leds_gpio nvmem_rmem joydev hid_cherry uas usb_storage gpio_raspberrypi_exp v3d snd_pcm raspberrypi_hwmon gpu_sched bcm2835_wdt broadcom bcm_phy_lib snd_timer genet snd mdio_bcm_unimac clk_bcm2711_dvp soundcore drm_display_helper pci e_brcmstb cec ip6_tables ip_tables fuse [ 369.757400] CPU: 2 PID: 1023 Comm: fbtest Not tainted 5.19.0-rc6+ #94 [ 369.757455] Hardware name: raspberrypi,4-model-b Raspberry Pi 4 Model B Rev 1.4/Raspberry Pi 4 Model B Rev 1.4, BIOS 2022.10 10/01/2022 [ 369.757538] pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 369.757596] pc : __mutex_lock+0x348/0x424 [ 369.757635] lr : __mutex_lock+0x348/0x424 [ 369.757672] sp : ffff80000953bb00 [ 369.757703] x29: ffff80000953bb00 x28: ffff17fdc087c000 x27: 0000000000000002 [ 369.757771] x26: ffff17fdc349f9b0 x25: fffffc5ff72e0100 x24: 0000000000000000 [ 369.757838] x23: 0000000000000000 x22: 0000000000000002 x21: ffffa618df636f10 [ 369.757903] x20: ffff80000953bb68 x19: ffffa618e0f18138 x18: 0000000000000001 [ 369.757968] x17: 0000000020000000 x16: 0000000000000002 x15: 0000000000000000 [ 369.758032] x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47 [ 369.758097] x11: 00000000ffffdfff x10: ffffa618e0c79f88 x9 : ffffa618de472484 [ 369.758162] x8 : 000000000002ffe8 x7 : c0000000ffffdfff x6 : 00000000000affa8 [ 369.758227] x5 : 0000000000001fff x4 : 0000000000000000 x3 : 0000000000000027 [ 369.758292] x2 : 0000000000000001 x1 : ffff17fdc087c000 x0 : 0000000000000028 [ 369.758357] Call trace: [ 369.758383] __mutex_lock+0x348/0x424 [ 369.758420] mutex_lock_nested+0x4c/0x5c [ 369.758459] fb_deferred_io_mkwrite+0x78/0x1d8 [ 369.758507] do_page_mkwrite+0x5c/0x19c [ 369.758550] wp_page_shared+0x70/0x1a0 [ 369.758590] do_wp_page+0x3d0/0x510 [ 369.758628] handle_pte_fault+0x1c0/0x1e0 [ 369.758670] __handle_mm_fault+0x250/0x380 [ 369.758712] handle_mm_fault+0x17c/0x3a4 [ 369.758753] do_page_fault+0x158/0x530 [ 369.758792] do_mem_abort+0x50/0xa0 [ 369.758831] el0_da+0x78/0x19c [ 369.758864] el0t_64_sync_handler+0xbc/0x150 [ 369.758904] el0t_64_sync+0x190/0x194 [ 369.758942] irq event stamp: 11395 [ 369.758973] hardirqs last enabled at (11395): [] __up_console_sem+0x74/0x80 [ 369.759042] hardirqs last disabled at (11394): [] __up_console_sem+0x6c/0x80 [ 369.760554] softirqs last enabled at (11392): [] __do_softirq+0x4c4/0x6b8 [ 369.762060] softirqs last disabled at (11383): [] __irq_exit_rcu+0x104/0x214 [ 369.763564] ---[ end trace 0000000000000000 ]--- Fixes: d536540f304c ("drm/fb-helper: Add generic fbdev emulation .fb_probe function") Signed-off-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann --- Changes in v2: - Re-introduce the CONFIG_FB_DEFERRED_IO ifdef guard for the @fbdefio field declaration since the kernel test robot reported that's needed at the end. drivers/gpu/drm/drm_fbdev_generic.c | 11 +++++------ include/drm/drm_fb_helper.h | 12 ++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c index b2df8c03594c..bd1f8f28297c 100644 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@ -171,11 +171,6 @@ static const struct fb_ops drm_fbdev_fb_ops = { .fb_imageblit = drm_fbdev_fb_imageblit, }; -static struct fb_deferred_io drm_fbdev_defio = { - .delay = HZ / 20, - .deferred_io = drm_fb_helper_deferred_io, -}; - /* * This function uses the client API to create a framebuffer backed by a dumb buffer. */ @@ -222,7 +217,11 @@ static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper, return -ENOMEM; fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; - fbi->fbdefio = &drm_fbdev_defio; + /* Set a default deferred I/O handler */ + fb_helper->fbdefio.delay = HZ / 20; + fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io; + + fbi->fbdefio = &fb_helper->fbdefio; ret = fb_deferred_io_init(fbi); if (ret) return ret; diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index f443e1f11654..497bb3a0b943 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -203,6 +203,18 @@ struct drm_fb_helper { * the smem_start field should always be cleared to zero. */ bool hint_leak_smem_start; + +#ifdef CONFIG_FB_DEFERRED_IO + /** + * @fbdefio: + * + * Temporary storage for the driver's FB deferred I/O handler. If the + * driver uses the DRM fbdev emulation layer, this is set by the core + * to a generic deferred I/O handler if a driver is preferring to use + * a shadow buffer. + */ + struct fb_deferred_io fbdefio; +#endif }; static inline struct drm_fb_helper *