Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13115783rwl; Wed, 4 Jan 2023 03:54:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXujJYcJDT5vLY7jxrFvdQLYLtvv60s2DQ60Rf+CZCHCw/Xn38wwaxhgv5VzyAkIJ44PfTr8 X-Received: by 2002:a17:906:4e54:b0:812:d53e:1084 with SMTP id g20-20020a1709064e5400b00812d53e1084mr45883628ejw.70.1672833253096; Wed, 04 Jan 2023 03:54:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672833253; cv=none; d=google.com; s=arc-20160816; b=AGKx0s6zIOn8rQm9FDmMSDvTYP2yDQWKnZkds79oguz09s6uOZyVkgasFcWzEaaFIY aesLVuxeAmHwp8Gtu52OQsycKCIt8kTg2aH+w8fTBhMqGK7ZoPo8L7jAa5T4wnjY/Ekq IbBiGUZbpw8/ef6wQt7CBbXgxRjeg9WjL8I0b0DddPYc6/NGNUp3JArx2o4MIa91Jy9P j0kUz1Gzrm1VGz4aY07GNjfFxJDPiz6H2CT/HzKvEAxjgoW4d22bHGGCj8ixJcZSv1kb yOVsbdWeNs+uGlVfQYzGEY2vQnZi3EsrTzVhF2YjEy2z+4zNuObWROHx5lSMa8quxauz xWcg== 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:message-id:subject:cc:to:from:date; bh=Qo9hS6yBpX/B3f19FijUoef1aIPRniAoJKM66tM6kkk=; b=Iuj/iVL2LMHAAWRef62gMOe4GBaXMmMh9SUyInv34gc0xCzl9obO8TYiKTwKyCvXHo WcYrN1YvQrsMupSr5GoLkhV96IHs66ubFydz1PWQ1g9KflZNa+bi6iX2Ow14w48l22J8 wtLxVcjWMt9auzuJ3uq4J4PsClChAghzHtwWGQhfZl7iv9jiWQC8BfKFuKSujThhxnZL tTXAvBE12vJeZiQVmZCT66xJc/+Z0I6fDhsUwRdzqK7Nsx0wpOssZSCGNztTy/UWlpWK 0Vm3hkw0eWqQAK22grZ1x032AA+uAp64CsU3NuslZL8JbRYiwXm3P4eF/tqSEzs4QxCk bPbQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt8-20020a170906ee8800b0078d288ddfc9si31016611ejb.143.2023.01.04.03.54.00; Wed, 04 Jan 2023 03:54:13 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234016AbjADL2K (ORCPT + 57 others); Wed, 4 Jan 2023 06:28:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbjADL2J (ORCPT ); Wed, 4 Jan 2023 06:28:09 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9FE441AA33 for ; Wed, 4 Jan 2023 03:28:08 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 246B11596; Wed, 4 Jan 2023 03:28:50 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.37.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 736F03F587; Wed, 4 Jan 2023 03:28:07 -0800 (PST) Date: Wed, 4 Jan 2023 11:28:04 +0000 From: Mark Rutland To: Yann Sionneau Cc: linux-kernel@vger.kernel.org, Clement Leger , Jules Maselbas , Julian Vetter Subject: Re: [RFC PATCH 13/25] kvx: Add signal handling support Message-ID: References: <20230103164359.24347-1-ysionneau@kalray.eu> <20230103164359.24347-14-ysionneau@kalray.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230103164359.24347-14-ysionneau@kalray.eu> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Tue, Jan 03, 2023 at 05:43:47PM +0100, Yann Sionneau wrote: > Add sigcontext definition and signal handling support for > kvx. [...] > +asmlinkage void do_work_pending(struct pt_regs *regs, > + unsigned long thread_flags) > +{ > + /* We are called with IRQs disabled */ > + trace_hardirqs_off(); > + > + do { > + if (thread_flags & _TIF_NEED_RESCHED) { > + schedule(); > + } else { > + local_irq_enable(); > + if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) > + do_signal(regs); > + > + if (thread_flags & _TIF_NOTIFY_RESUME) { > + clear_thread_flag(TIF_NOTIFY_RESUME); > + resume_user_mode_work(regs); > + } > + } > + /* Guarantee task flag atomic read */ > + local_irq_disable(); > + thread_flags = READ_ONCE(current_thread_info()->flags); The comment here is a bit misleading; disabling IRQs doesn't affect the atomicity of the read (and flags can be set by remote threads), so I'd recommend removing it. Please use read_thread_flags() to read the flags. > + } while (thread_flags & _TIF_WORK_MASK); > +} Thanks, Mark.