Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp356371pxb; Wed, 18 Aug 2021 04:10:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaNQZ/N18U0TdvvJerxn76PfDY9jtMsioeQ8I4GOjma9dxKh5QDQB2GToiIrWozN0swpkC X-Received: by 2002:a17:906:72ce:: with SMTP id m14mr8956817ejl.394.1629285025491; Wed, 18 Aug 2021 04:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629285025; cv=none; d=google.com; s=arc-20160816; b=We9G72mhACh6ksONn4JBU9khu+V/j4OJP2kebFtjcN8WIEvVjK2kARas5UkmGCiprZ utMAL+ggyDdyeVJ7eoB/gB4cLDbcj+YWa0WF3Qnzq9QXJP7S5kL7wV1BGW8L15t/pwo5 ntJeRiu48krcnSyuOahFEVnB3s2DdHt7+GUBHz11TG2W91EnpSgrIC7sU2Vf1JBJS0Bs RGyPQlhohOO1ZVMaRsdEsAkGWJixJBQk28mx5GgS03qq4jH52bEFjP3Zu4r4J2uahSqv 3/ypkXXD7olXDhRgsKhArObXCegEu7kEJ/Iq+LdSmw8B4bJL0MiJoAN8wx7eVltNMOoW sP4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NPOr3Gsm++Jn+YbgaVuAdXWQs+lGHRq4aVwKxZvTaSw=; b=xPM6V25euYHRchq7R/vcykETI+vYdLq/sSIlmI2vd4wnQPYOXWP07lxKLpf6q4D9rg 2Iv+NB3HIf1JGquzOm38ToijSJAWRKnRIxc7O1C4g4geaaNR7i6q+FiO6vH6rE69+JKB IIXUWPySUEqhWbtCkdA4FKsrMfwDXUqJDCGczWyXqNGgg4GTEi2UuZ61t3frxVky+Naz w6GYDmZhNr9OB1HOiN79Ouiv8ITT/T9ai0+dGE+NZF51uxapKHWD7w34M8s2Mdn1TxzU 54Jy5fgbOJFAHQ/xr33dAYLiiLMxP7U1/bmbeoj8mB23zxQZpaGgX2ZXLFjwuoQEq+GP XVHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="Gb+bX/DM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si5191603edc.286.2021.08.18.04.10.00; Wed, 18 Aug 2021 04:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="Gb+bX/DM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235272AbhHRLHR (ORCPT + 99 others); Wed, 18 Aug 2021 07:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbhHRLHP (ORCPT ); Wed, 18 Aug 2021 07:07:15 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3875DC0613CF for ; Wed, 18 Aug 2021 04:06:41 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id k8so2895840wrn.3 for ; Wed, 18 Aug 2021 04:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=NPOr3Gsm++Jn+YbgaVuAdXWQs+lGHRq4aVwKxZvTaSw=; b=Gb+bX/DMqPhU/Gs13lF8AY1wqU95YsbV5W+CDvEpOSq0hnHYwwvnW6d/lNA9UADnZX 09wq+/BL4admOxeXXY4T1RPPuMJyOhLwUN6623S+X/BbKTRUPVQ4UIq69HbzA1KcPZ+B Hjsq2uYLK6ZiY0UjkL8U9aT8QL0lkk0TXVXCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=NPOr3Gsm++Jn+YbgaVuAdXWQs+lGHRq4aVwKxZvTaSw=; b=JOMxPW+t4xpOKj0VDOgGkFvhUIxy7eH+OpPZ6JnGnRjQddrT4sx37eeIxXlCZlQOOZ MzsrroZp8hx3D9kzAiMYtjCDMYJy/QVCK71rlsdeEUo00nV0wegNdlSud/lmU7N5EwAI rtpSLYSh/lkMq5HdfGxNdMX9J4ryWStt7IWSs9h72LHBR08+i6fSr2XP1Fkbldv9GoWs pdh4NN2fdwPIwg5Za0LaS2gOWr1tfHOqOTPDo1pbi7wrgpvIyDLAvWEr4Wnk3U9htI1e MnnejHMPFFPOJU2A3kUoOTOtmyo8tZQiHisGXC7cIR5PMJ/BKvu7T8k84GutvFFqY4zG h9ag== X-Gm-Message-State: AOAM530OuOo9gWNLGzwU2njMEVh7QRq0ptUDJO8sc++TnxujGO6jZSqA g3LZ6UvuwdJQyRIDKt2B7jXfyQ== X-Received: by 2002:adf:f282:: with SMTP id k2mr9819865wro.255.1629284799276; Wed, 18 Aug 2021 04:06:39 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id d8sm5575127wrx.12.2021.08.18.04.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 04:06:38 -0700 (PDT) Date: Wed, 18 Aug 2021 13:06:36 +0200 From: Daniel Vetter To: Desmond Cheong Zhi Xi Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch, sumit.semwal@linaro.org, christian.koenig@amd.com, axboe@kernel.dk, oleg@redhat.com, tglx@linutronix.de, dvyukov@google.com, walter-zh.wu@mediatek.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, skhan@linuxfoundation.org, gregkh@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, kernel test robot Subject: Re: [PATCH v3 8/9] kernel: export task_work_add Message-ID: Mail-Followup-To: Desmond Cheong Zhi Xi , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, sumit.semwal@linaro.org, christian.koenig@amd.com, axboe@kernel.dk, oleg@redhat.com, tglx@linutronix.de, dvyukov@google.com, walter-zh.wu@mediatek.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, skhan@linuxfoundation.org, gregkh@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, kernel test robot References: <20210818073824.1560124-1-desmondcheongzx@gmail.com> <20210818073824.1560124-9-desmondcheongzx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210818073824.1560124-9-desmondcheongzx@gmail.com> X-Operating-System: Linux phenom 5.10.0-7-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 03:38:23PM +0800, Desmond Cheong Zhi Xi wrote: > The task_work_add function is needed to prevent userspace races with > DRM modesetting rights. > > Some DRM ioctls can change modesetting permissions while other > concurrent users are performing modesetting. To prevent races with > userspace, such functions should flush readers of old permissions > before returning to user mode. As the function that changes > permissions might itself be a reader of the old permissions, we intend > to schedule this flush using task_work_add. > > However, when DRM is compiled as a loadable kernel module without > exporting task_work_add, we get the following compilation error: > > ERROR: modpost: "task_work_add" [drivers/gpu/drm/drm.ko] undefined! > > Reported-by: kernel test robot > Signed-off-by: Desmond Cheong Zhi Xi Just realized another benefit of pushing the dev->master_rwsem write locks down into ioctls that need them: We wouldn't need this function here exported for use in drm. But also I'm not sure that works any better than the design in your current patch set ... -Daniel > --- > kernel/task_work.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/task_work.c b/kernel/task_work.c > index 1698fbe6f0e1..90000404af2b 100644 > --- a/kernel/task_work.c > +++ b/kernel/task_work.c > @@ -60,6 +60,7 @@ int task_work_add(struct task_struct *task, struct callback_head *work, > > return 0; > } > +EXPORT_SYMBOL(task_work_add); > > /** > * task_work_cancel_match - cancel a pending work added by task_work_add() > -- > 2.25.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch