From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F0A7ECAAD3 for ; Tue, 6 Sep 2022 01:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232684AbiIFBqZ (ORCPT ); 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-Google-Smtp-Source: AA6agR7rQMCHzliXpvc366478Lt3HDQkS0AJxe6688qZr6jFNV0WLHEbuu6BgOf1F0gYkq5AKEjr6QkCE3JufBBZ0vk= 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 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