Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3798609rwb; Mon, 5 Sep 2022 19:31:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6FCSZISnruJhE9/OgMZHSFtKjD2b6FkQiKd+fIuX5hNWkSk8ve0LneEHdOXoKpPiy+fK/+ X-Received: by 2002:a17:907:7249:b0:76e:5d04:1db1 with SMTP id ds9-20020a170907724900b0076e5d041db1mr3089670ejc.172.1662431472949; Mon, 05 Sep 2022 19:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662431472; cv=none; d=google.com; s=arc-20160816; b=yJycLKOc5wk3UAHctHgvooLmg6HcA2/uXCVQG/xjycW3Jvpn+YCnHfWcxZDZSvKpKv yJBEaAC0gBKopl8zgB3xATcbCC6u5vC1KOlUeYAxNI3fQ8ZBw4OBL7pZXXU7z8KMMRV/ Qlf82mZeajoS8nbSbQThCcZt6IoyeZHN63BlARrMpRANk47volU4YfBUjFR2SGEurskN 6cOqv8RepzIJ+wZXeLOnqLpYRf6OVcNdNDrd7+nbCq7kfjLNsy+QLrt5gW240/xEa9/S zdbTAipawjIcpn6LClfGhA90asQGg9Sav4hPaVJzhIp4f7rPm3DeCDa3P2IPIhPwY8e3 l1lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9rqSb5G3SmgV9/9REPaiBBSVYxKzftAm0zyG43aAajo=; b=TJ03nIdfuFMx9wOcmjkQUz/wvIsOysOeNHhQCQqyrh8FxBJErmUZAmfSBpmLGNqmAK FyYuXtpsgzvyPG8SkTBY4OAnEnh/RL0MF8DVblXfwfaxd1IiBoz1eXfS1ApLiZbS6ToJ liU+a90VgBrw8s65uD/eXI6MwOxQEDp5JkoV/1Io4zATFioClZblzz2KCwJd1zSnPD98 iVVLTwsZrNDIeqNVn8zHD6uDcRgsYR9wqYJB2N/I5TJJBzhdo6nq0Z3g44n4bVGpz5tT 2SyRRnsFFP7IPJK9vCgCE+7IFzwyqQoJcr8V7Vl7CvQ83ktZZ2XWcOAp/BTxmNmkfFyM WeVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bm0qjyC2; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a05640234c700b00447ceeb8c75si9362631edc.593.2022.09.05.19.30.47; Mon, 05 Sep 2022 19:31:12 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=bm0qjyC2; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbiIFBqZ (ORCPT + 99 others); Mon, 5 Sep 2022 21:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232640AbiIFBqX (ORCPT ); Mon, 5 Sep 2022 21:46:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9326F65550; Mon, 5 Sep 2022 18:46:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02739B815CE; Tue, 6 Sep 2022 01:46:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 924C2C43143; Tue, 6 Sep 2022 01:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662428778; bh=xs4xCHPpRTSPH1q5xqbVYT0d5Xh7RHhnV/wtT03qh9o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bm0qjyC2t9TwGwEG24yn5DgveTfSTLhfHEAIhHPyWVHs5IujJtgloa9bLyT8PGsAp Y2deaM+vuMaSfJUUuZN2olk2QgX7fzARBfTeAxI3+k3ofdvt7yKL8sZS/72uEVa6UP mfnVNtMossvMA9z5Eu11si7P1+lWKTHWiTu0WeS8i8QmUdgevP4vCX8I0t93Bz0ZaQ UpBBSDjZ2IlRa9BKft/sfJEafi2pHU7RrmdimbnyrGWpORCOweKwcgoyu5acYCGJGX otwfmTxF0tCSpmlp3q1lKLTZXTHcA+HvF+A0689X4Lq0bQ81E3KJocAjy1lsZhk6D+ 8iW7KwNrfFFgw== Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-1278624b7c4so6732248fac.5; Mon, 05 Sep 2022 18:46:18 -0700 (PDT) X-Gm-Message-State: ACgBeo00HcmmJHRcBWJ+kfVoiuZgsgsjUi2rb76fW3V91z6brpOk8l3r AwxUJCOH2pYtMMSVozAGlb44DNxgMpWqDuXciKA= X-Received: by 2002:a05:6870:c596:b0:101:6409:ae62 with SMTP id ba22-20020a056870c59600b001016409ae62mr10373144oab.112.1662428777684; Mon, 05 Sep 2022 18:46:17 -0700 (PDT) MIME-Version: 1.0 References: <20220831175920.2806-1-jszhang@kernel.org> <20220831175920.2806-5-jszhang@kernel.org> In-Reply-To: From: Guo Ren Date: Tue, 6 Sep 2022 09:46:05 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 4/5] riscv: add lazy preempt support To: Sebastian Andrzej Siewior Cc: Jisheng Zhang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Thomas Gleixner , Steven Rostedt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Mon, Sep 5, 2022 at 4:46 PM Sebastian Andrzej Siewior wrote: > > On 2022-09-05 16:33:54 [+0800], Guo Ren wrote: > > > There is "generic" code in the PREEMPT_RT patch doing that. The count= er > > > is incremented/ decremented via preempt_lazy_enable()/disable() and o= ne > > > of the user is migrate_disable()/enable(). > > > Basically if a task is task_is_realtime() then NEED_RESCHED is set fo= r > > > the wakeup. For the remaining states (SCHED_OTHER, =E2=80=A6) NEED_RE= SCHED_LAZY > > > is set for the wakeup. This can be delayed if the task is in a "preem= pt > > > disable lazy" section (similar to a preempt_disable() section) but a > > > task_is_realtime() can still be scheduled if needed. > > Okay, It should be [PATCH RT]. RISC-V would also move to GENERIC_ENTRY > > [1], so above assembly code would be replaced by generic one, right? > > correct. Maybe TIF_XXX_RESCHED also could be merged into GENERIC_ENTRY, just like what you've done in syscall. struct thread_info { unsigned long flags; unsigned long syscall_work; /* SYSCALL_WORK_ flags */ + unsigned long resched_work; /* RESCHED flags */ Or merge them into one: struct thread_info { unsigned long flags; - unsigned long syscall_work; /* SYSCALL_WORK_ flags */ + unsigned long ge_flags; /* GENERIC_ENTRY flags */ > > Sebastian --=20 Best Regards Guo Ren