Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1298982lqb; Thu, 18 Apr 2024 06:12:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVaoWrcb/VHWAkKQDxOzyEvfZdJ9vwueAC8HvXWltabCxCP1yepoIIUkIKNn6KttprbmxOB7fRbRs+edjsGzaxVSaG9w1O4TJFPHDDGDg== X-Google-Smtp-Source: AGHT+IF4u95w7lyPMBGWOg0/D2DgZlbz9mWcwZz/bEJuWWawy2mQFSymKJWRymqPyyQ9CKI1T9Hq X-Received: by 2002:a05:6a00:ccb:b0:6ed:de6f:d762 with SMTP id b11-20020a056a000ccb00b006edde6fd762mr3093998pfv.6.1713445957691; Thu, 18 Apr 2024 06:12:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713445957; cv=pass; d=google.com; s=arc-20160816; b=cWuj+oW+bdApnD9b0RKnluLJJhVURF9FRlMzFVOcz0mubvbK+GefA9PosaI2RY9dJj 82i2Ii3doS6fhUTzpgtuI8bf/RTMizoKo0Gstvvq8TFVuOsuhY/MVFL0SSwGqFATggcE 2L4E/uLkURFC6TrGy1+hHOjilzZQw50pq0tscwU1eA07wVGbhdQikz/KewqbxGJ+Pr42 afX6JzuNxdUfn3uAOXQiVSmgMbPeDA6krfPeIT/xsrxIuifa3bADfnfg7Pd1GFpzdVoB ClauOMXBlM7Hga2hXFSUa5tkxcbz+9PqemFTI6uIpwOux0BFX6syiFh4RsJTvHS3kj+q qfkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=s7DOuhy0FvgdVscxhexEi9GDhNcDoFdv6wRWpKftVNE=; fh=a84hEY3tv80GkS+wxFxku00KOfYNtV24WI07TV2BZR0=; b=HyR4TRUVNuVpE+I9+GjhJRuxN5O4zwqp9TjAc43+FOcSlZ9wUicVh2l2h98tSckQmb Spcz4tE0YI47O1LCnIoPeSkR32mV20dxi89ox3iMHPkA8fH+syNVrxEes8u+H7H8Z52B 2O2F28flb8HxBFDOkMvqzSlhQSFzqDxHlJ8oIFXRxfU4GAjUoVq7WWf+0wTSIypSIJLH CJgoVX2W2dhFwwWzPpuBS7Y4gojJCkKXWDVhxUWfbJaAEkT4uz35OWwxbLpFHljHbp+y O3p6QieLMw0BxsuzLb8jtvB1jLFhLH1JhpCQhD/mOizzAbInGRMqC4z3Qzj/BHL6S+F4 LS8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=NB5zSt5p; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-150135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150135-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ka39-20020a056a0093a700b006e6c4e74321si1506352pfb.29.2024.04.18.06.12.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 06:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=NB5zSt5p; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-150135-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150135-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com 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 9C721B22BBC for ; Thu, 18 Apr 2024 13:09:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0239EAD2; Thu, 18 Apr 2024 13:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="NB5zSt5p" Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DF9C81AA2 for ; Thu, 18 Apr 2024 13:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713445762; cv=none; b=uttKvshtAi5jSOpzXh31EpP1isVORsCezov9VSOARE9LJfEX1W0jdEya8Nsb1OryuV2khzXIbwpZaBvTAIDuQgT57iVUFWsFyPKTs/3Gr0gHZlBUQRMb2nGqydBjwYNNwm04Fvn6sxVARikGoujLxNw7pyhbSxn6e/x1g8xIvDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713445762; c=relaxed/simple; bh=X+U4lYI1ltAh+ScRo/qpfNjCt3veXdLbLYQ4JvMTKk0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rkB1R2Kr5W6k/zYC00+Ac0hs18F9MmOasPWvSdYJoQM1K4zqHL4uMhZhE8EyD/I0U4sU0u04BaNqUEKyJ8Y+if1Wop3lPBFb2Y0ggFhbPyWivRwpI4vyrPePklTuWW6kbb/jBlyGPQT9Uas5H/aXbcr5Y148ysrxjli980DTlRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=NB5zSt5p; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-53fa455cd94so593661a12.2 for ; Thu, 18 Apr 2024 06:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1713445757; x=1714050557; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=s7DOuhy0FvgdVscxhexEi9GDhNcDoFdv6wRWpKftVNE=; b=NB5zSt5pR7ul1hzazXCw3c4MEPZ/Bob9vZiZBEcS25L4+jmmMJahqwwBsR/gaTDk+c 1e6QEo0TVmFxoZDFYM+HUV5OG9N4OZNcobc7AUUGfU5OQFafkx1K+1xvsZsTsvl8QhvX i9z5VwuYTpLMZ366KIsw06vL8iSJhWblWiGsZsi26m/RLJUXZAwuNJ2ojK2JJi8tVri5 hFd7Pxrh42Vmo1uNh0p5JumqV+gp9NgHv9LEUKfM9qN8ADEPmA2s/9B9W5mCFf/ixdgi NjYIAlzCe7n85ErY9VPKhvdoND6w0eFFJQsAtc4sGNtFolNimulieFa+uhOE4K8lAGSD bP3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713445757; x=1714050557; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s7DOuhy0FvgdVscxhexEi9GDhNcDoFdv6wRWpKftVNE=; b=CS/RR8mTw5m+K1imbgqq+vsDLX+mWYliyELjmAixivxFQZpeHdex6sbh/dsCIzdBMI O/TkSMJl2Vp78Gs0kLK2HJMxMQ4ggyQ+qPtWtFMECvvUwd8/hZzM6pHdGKicuSSxUV1t SbeDXLMggXQddTSNZkVruuFZTQ0fwsFBooj6NSOPLWsH63bCNoEGMVeBdvM8h1FVz0kx ed6kCMooa5Mj9SZ/rSteclJsy6sD/Hv0L9oA85QCw4Nah7mafndJT42OgQFsvbUhjQ7D YYWqp5Go7uLwwexnA5dxWtPtdF7foCHTgyv6pFNzTg72Uxr5hTFzdAIs7LGa1goTIMvy RoCA== X-Forwarded-Encrypted: i=1; AJvYcCX0nYTeUssxRt/aW9FrcqnZ2Hp6jPOY7Q0BaScJSEnzirR+TiWDxr1rQ+qdfBGUdF9L4cvm8NPDwsmXwU9pJYTITmCqk4ZSqfnmG+PN X-Gm-Message-State: AOJu0YyiBsmOPMSAnVPOaMrk5kQUb/Iy77yLdrPAGTxPdN4Y7zRyDbAA a4E3PErm2XOKgvCeaBZ0sA8szGQ4vlJYl+pqmTJynurvKPhdVofxIWfRZmdTHU5ROHbFGxufZoj AaIxS3r0xONGRhNWh8XoYwGy1YqahVhsv0V99OQ== X-Received: by 2002:a17:90b:b14:b0:29d:dd93:5865 with SMTP id bf20-20020a17090b0b1400b0029ddd935865mr2258889pjb.46.1713445757422; Thu, 18 Apr 2024 06:09:17 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240418114942.52770-1-luxu.kernel@bytedance.com> In-Reply-To: From: Xu Lu Date: Thu, 18 Apr 2024 21:09:06 +0800 Message-ID: Subject: Re: [External] Re: [RFC 0/2] riscv: Idle thread using Zawrs extension To: =?UTF-8?Q?Christoph_M=C3=BCllner?= Cc: Andrew Jones , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, andy.chiu@sifive.com, guoren@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, lihangjing@bytedance.com, dengliang.1214@bytedance.com, xieyongji@bytedance.com, chaiwen.cc@bytedance.com, Conor Dooley Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 18, 2024 at 8:56=E2=80=AFPM Christoph M=C3=BCllner wrote: > > On Thu, Apr 18, 2024 at 2:44=E2=80=AFPM Xu Lu = wrote: > > > > On Thu, Apr 18, 2024 at 8:26=E2=80=AFPM Christoph M=C3=BCllner > > wrote: > > > > > > On Thu, Apr 18, 2024 at 1:50=E2=80=AFPM Xu Lu wrote: > > > > > > > > This patch series introduces a new implementation of idle thread us= ing > > > > Zawrs extension. > > > > > > This overlaps with the following series: > > > https://lore.kernel.org/all/20240315134009.580167-7-ajones@ventanam= icro.com/ > > > > Hi Christoph. > > Thanks for your reply! > > Actually our patch series is different from this. The work from your > > link focuses on providing support for Zawrs and implementing spinlock > > using it, while our work focuses on implementing idle thread using > > Zawrs and accelerating IPI to idle cpu. Of course, the ISA ZAWRS > > config part can be merged. We will refine our code in the next version > > to reduce code conflicts. > > Yes, I've seen that this targets another optimization, but the basic > Zawrs support > would be identical to the other patchset (even if it is not). > I would propose that we work on a basic Zawrs support patchset that intro= duces > the Kconfig, DTS and hwprobe parts (a subset of Andrew's patchset). > Once this is merged, all other optimizations can be built upon it > (spinlocks, idle thread, glibc CPU spinning). > If this proposal is fine for the maintainers/reviewers, then Andrew could= resend > these basic-support patches. > > BR > Christoph Roger that! This does make more sense. We will rebase our code on Andrew's basic support patches in the next version. Regards, Xu Lu > > > > > > > > > > BR > > > Christoph > > > > > > > > > > > The Zawrs[0] extension introduces two new instructions named WRS.ST= O and > > > > WRS.NTO in RISC-V. When software registers a reservation set using = LR > > > > instruction, a subsequent WRS.STO or WRS.NTO instruction will cause= the > > > > hart to stall in a low-power state until a store happens to the > > > > reservation set or an interrupt becomes pending. The difference bet= ween > > > > these two instructions is that WRS.STO will terminate stall after a= n > > > > implementation-defined timeout while WRS.NTO won't. > > > > > > > > This patch series implements idle thread using WRS.NTO instruction. > > > > Besides, we found there is no need to send a real IPI to wake up an= idle > > > > CPU. Instead, we write IPI information to the reservation set of an= idle > > > > CPU to wake it up and let it handle IPI quickly, without going thro= ugh > > > > tranditional interrupt handling routine. > > > > > > > > [0] https://github.com/riscv/riscv-zawrs/blob/main/zawrs.adoc > > > > > > > > Xu Lu (2): > > > > riscv: process: Introduce idle thread using Zawrs extension > > > > riscv: Use Zawrs to accelerate IPI to idle cpu > > > > > > > > arch/riscv/Kconfig | 24 +++++++ > > > > arch/riscv/include/asm/cpuidle.h | 11 +--- > > > > arch/riscv/include/asm/hwcap.h | 1 + > > > > arch/riscv/include/asm/processor.h | 31 +++++++++ > > > > arch/riscv/include/asm/smp.h | 14 ++++ > > > > arch/riscv/kernel/cpu.c | 5 ++ > > > > arch/riscv/kernel/cpufeature.c | 1 + > > > > arch/riscv/kernel/process.c | 102 +++++++++++++++++++++++++= +++- > > > > arch/riscv/kernel/smp.c | 39 +++++++---- > > > > 9 files changed, 205 insertions(+), 23 deletions(-) > > > > > > > > -- > > > > 2.20.1 > > > > > > > > > > > > _______________________________________________ > > > > linux-riscv mailing list > > > > linux-riscv@lists.infradead.org > > > > http://lists.infradead.org/mailman/listinfo/linux-riscv