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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77A60C5475B for ; Thu, 29 Feb 2024 00:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YJzSgkrxq6EZp7zzt1g+HoY0WqJQ4Sujs+5kdb+tkBQ=; b=meIUGLQp1wuAT9 DaQGxwPja7OgWrjXiJVCEjwDoNXlPbP/+ghEAglzN9rPG1HicS304BdIUF+1K0fjs72vONTsI+KkO vUwLmudNchkrRPVpN7RurI9DDSLF5tZCKd3LpL0I0W3mvptkYhpBT7+YkPNzFY7XpVQMogk+tV1pr iuWATqA4B17V5CLltmbPhEXQfAZK0PzIMVSRAzyccStxB1pvKHN8BdycVx/IVDk0cIf5uTUKytgKO TeUrdeJFnDyQFpLk/9tLrg2KTQ8rrxNrw40ISy5dK+gGeO48PM8DmHHABngTvhm6hMYjI0n03ro/v VwVjCk9sFkEFbWRaxuxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfUVq-0000000BS5W-26bW; Thu, 29 Feb 2024 00:43:02 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfUVn-0000000BS4m-3tUA for linux-riscv@lists.infradead.org; Thu, 29 Feb 2024 00:43:01 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5669bf9013eso147175a12.1 for ; Wed, 28 Feb 2024 16:42:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709167378; x=1709772178; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ZmS4IRRjqluuahGyeQvOvUbUjo8O7pcJJoCmMytKQ98=; b=Y7DZRKT1OQ/jl/ZVx1BbAqB9OrZGzo2SKAO0ofrBXscfSRalROiWXYF2oy38g9aUZ5 e9rnSRuP6omqpOcFtVtdCtVRrqDywLZEX4T4F81hTNqUtVKg4qp45y0Mi4CUCyMpdzMS qS+CLojIqm9YkzI5mYcPJpIQEdV+aiEXNhPCYpYR2p+GAlYUW/G5khflsNKPVmkHuiyI PxAjYOBrNSHaYXmbs47cYYJOVOEfFobCKnE9F7naDqM/yCH0LqMDzrBnRGj6RjgGnYj6 pZNvh6ukhwNWPUQbihOckB9uEetph6eSvPUXr7k2ptDbXThnCFOHCvaATMXtnSqXfTnd MhZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709167378; x=1709772178; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZmS4IRRjqluuahGyeQvOvUbUjo8O7pcJJoCmMytKQ98=; b=aTBZaiTzIRKvtCnD4xrWeff2fr64bLEGL143R2T0i5XzS0YquCMG04indhRVQMLS0w +D0pyki4PQCoEOrQxySEicVL1+wbiErnBBFgR411iced1NQj3QTaWOmRyesbMxVLIHeL AtOzcSh9qd0vRb2Y2wc4Ov+u7GGXCywzj5RASQYOCAo1d4lxafPLXg7IccGrVFboS5mO 5BMqpVkHyyWZjesiIYerT5/GyhGKdoHHJ5lyLICmEfIZ90gws8QHUe9NhUZuvbUPrRwm Ef9TAzyfYjDBZM0ij+lG9iusN98uKF41+cxrcxcqZegWk3BjKWBN84ZDFD64E0LGu95/ mruw== X-Forwarded-Encrypted: i=1; AJvYcCW27ckTAQF12NJrFfBnwpmnkOgiRVOsPu4RLXEZ4nA1/Lb7TWbV39S3FZ3ujRR53N7D9N8HWBHLQU0QMAFIWI9ecXpeHCkDZZRLyBKG+XxQ X-Gm-Message-State: AOJu0YyMqH3F3SpTFD6F3hxQHh48AcbCR+E09bSR3ruBVkKhVy1brvfd Pv1lpDguYMjYO2d2huwmfn+zL5zuvm5Otj6pi9XqPOTSKQWyE2oO X-Google-Smtp-Source: AGHT+IEdA/lIroyr34aN4pYdmsq1xe9ghJmBWdnL6YBNd1En/M75YkACZP1NP7ZEJ0WAd80er8iU0w== X-Received: by 2002:a05:6402:268d:b0:564:d715:1d67 with SMTP id w13-20020a056402268d00b00564d7151d67mr400310edd.17.1709167377835; Wed, 28 Feb 2024 16:42:57 -0800 (PST) Received: from andrea ([31.189.122.3]) by smtp.gmail.com with ESMTPSA id i16-20020a50d750000000b005667b411c38sm74791edj.65.2024.02.28.16.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 16:42:57 -0800 (PST) Date: Thu, 29 Feb 2024 01:42:55 +0100 From: Andrea Parri To: Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrea Parri , Anup Patel , Steven Rostedt , Masami Hiramatsu , Mark Rutland , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Subject: Re: [PATCH 2/2] riscv: Fix text patching when IPI are used Message-ID: References: <20240228175149.162646-1-alexghiti@rivosinc.com> <20240228175149.162646-3-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240228175149.162646-3-alexghiti@rivosinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240228_164259_998558_DCDF28F5 X-CRM114-Status: GOOD ( 12.64 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Wed, Feb 28, 2024 at 06:51:49PM +0100, Alexandre Ghiti wrote: > For now, we use stop_machine() to patch the text and when we use IPIs for > remote icache flushes (which is emitted in patch_text_nosync()), the syst= em > hangs. > = > So instead, make sure every cpu executes the stop_machine() patching > function and emit a local icache flush there. > = > Co-developed-by: Bj=F6rn T=F6pel > Signed-off-by: Bj=F6rn T=F6pel > Signed-off-by: Alexandre Ghiti Modulo the removal of the hunk discussed with Samuel, Reviewed-by: Andrea Parri Some nits / amendments to the inline comments below: > + /* > + * Make sure the patching store is effective *before* we > + * increment the counter which releases all waiting cpus > + * by using the release version of atomic increment. > + */ s/cpus/CPUs s/release version/release variant The comment could be amended with a description of the matching barrier(s),= say, "The release pairs with the call to local_flush_icache_all() on the waiting= CPU". (Same for the comment in patch_text_cb().) Andrea _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 AEA49249ED; Thu, 29 Feb 2024 00:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709167381; cv=none; b=j6V0uTxUsrkcAyFaXg7zBppi/BKkH3xv2d2TP1ILqR0FaSv3GQSiedN+QLgpuoJaV1FQ1uCIEmp94u6B0Wgz79thw8b9vTqu56J8Xm8nO0YS6vZLW6wHMXn0UGE0jXWK+bxFjZnjfqUwYlzTATUqiFBiUaQFmLTqyFpOqykJzCc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709167381; c=relaxed/simple; bh=n4Tb5ua0L8EebpFdtEUvj5UmxXNuiua3ipJgiQdU48g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Td32P6si7yOxqG6U/6aWFbQGAEKdPU20FG028xF7EjH8smq0coWvTDCz5cFYzzDa6IdJIkajQFipobCnQlMJESaWF9N3wlsU0VRN+579th5heEfNIiKJ6hWhnIXzjQof+LXJhnOncaOiP4Kzoogdpe5rYuUIoHZK4a8/qvrS5iA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I1m9EYo9; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I1m9EYo9" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5669bf9013eso147174a12.1; Wed, 28 Feb 2024 16:42:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709167378; x=1709772178; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ZmS4IRRjqluuahGyeQvOvUbUjo8O7pcJJoCmMytKQ98=; b=I1m9EYo95nk9Rw75ArU5yrzTFVld24zxVvb1yjSJO1NecJglvxvGFlu9haaSimKrdo yXjas5ZuzFuHAkJyPjyKY9KpuOzGu92bKmwhFtcgdJeB1ifvC5+ej55O8lCDVphw3v62 9fvFpRCaxc6P+koQ3lehbQMd0+H8yGQgd+tBQbqxt6FRwkHFreq74QMp06s/oiCoHXKf uRb2O1SkQQ4WAByzCbWs4zxdwf46Q6h+rw9TYeocDeW3+IAgToxxiDJSmxZNTXqN5mpC sdskjNhrgDOqdPo/ZaFDm1LSRrDp7Z4/2UukkAQ8+bZPmwb5eJgYznJeNJP+p9iRI7PB 53yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709167378; x=1709772178; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZmS4IRRjqluuahGyeQvOvUbUjo8O7pcJJoCmMytKQ98=; b=eznj2uTqS5RkBUDLecCV748yXteNIIO2m0OWVvOOvhcrJQAJ7BLvH68mMDNmfFmT+4 HE1q6f9wnR3QHQrFLOYoHaor26midkGGFuaQhLnEfGtJx3DLk6DSOfqMvirV305jzxOy 9u/pUVbI+m7SW4f6gpZWoWDPZpUSw3J+eay85eQ1AufAahyOoPL/ItVo42tmdrPgzC2p RJ5FyoyC9ioG4CXhpOYRi3I1OgD/g5OifQuCHeCRjkD7Pwi/IZuXSoFNE/EGcv9lpJRq x5/zQMFuAlurxhjn6ovxH3gbKWJ6Q21tcmI8pbJCxFUXOaETEe2NiIFNPCHxJJEqFFmm exYA== X-Forwarded-Encrypted: i=1; AJvYcCVeuThzUeTOVZqeYjLzoQMiLZTX0pBwL7xnYXNmQxEP4LgB5FpPOgpGq20ygbsbo4/IM30xOxAT+poL/rxLCRWWJoOGKeRXOevnetQpbRmcAlHr8sfwIxZH6B63X0AHYWHQydCycwoj3L8+eoewLNuG X-Gm-Message-State: AOJu0YxhyUf/csJ3kXePCXIcmMYjISEvABwXM9oYKHy6mSV0ICnkk+Uy uaQA42txPiFWXW1FcZ/5hKhXge57/92YpZV+KHOnAlf9pmODcM/0 X-Google-Smtp-Source: AGHT+IEdA/lIroyr34aN4pYdmsq1xe9ghJmBWdnL6YBNd1En/M75YkACZP1NP7ZEJ0WAd80er8iU0w== X-Received: by 2002:a05:6402:268d:b0:564:d715:1d67 with SMTP id w13-20020a056402268d00b00564d7151d67mr400310edd.17.1709167377835; Wed, 28 Feb 2024 16:42:57 -0800 (PST) Received: from andrea ([31.189.122.3]) by smtp.gmail.com with ESMTPSA id i16-20020a50d750000000b005667b411c38sm74791edj.65.2024.02.28.16.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 16:42:57 -0800 (PST) Date: Thu, 29 Feb 2024 01:42:55 +0100 From: Andrea Parri To: Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrea Parri , Anup Patel , Steven Rostedt , Masami Hiramatsu , Mark Rutland , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Subject: Re: [PATCH 2/2] riscv: Fix text patching when IPI are used Message-ID: References: <20240228175149.162646-1-alexghiti@rivosinc.com> <20240228175149.162646-3-alexghiti@rivosinc.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240228175149.162646-3-alexghiti@rivosinc.com> On Wed, Feb 28, 2024 at 06:51:49PM +0100, Alexandre Ghiti wrote: > For now, we use stop_machine() to patch the text and when we use IPIs for > remote icache flushes (which is emitted in patch_text_nosync()), the system > hangs. > > So instead, make sure every cpu executes the stop_machine() patching > function and emit a local icache flush there. > > Co-developed-by: Björn Töpel > Signed-off-by: Björn Töpel > Signed-off-by: Alexandre Ghiti Modulo the removal of the hunk discussed with Samuel, Reviewed-by: Andrea Parri Some nits / amendments to the inline comments below: > + /* > + * Make sure the patching store is effective *before* we > + * increment the counter which releases all waiting cpus > + * by using the release version of atomic increment. > + */ s/cpus/CPUs s/release version/release variant The comment could be amended with a description of the matching barrier(s), say, "The release pairs with the call to local_flush_icache_all() on the waiting CPU". (Same for the comment in patch_text_cb().) Andrea