Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp329349pxu; Wed, 14 Oct 2020 02:24:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPDQwad8UlskE6arc3+nqDxdUYqbH0fKFY5oELCaM8mHECK+IUTjzX135xm1L//K7cVGuu X-Received: by 2002:a17:906:4d10:: with SMTP id r16mr4571297eju.68.1602667498262; Wed, 14 Oct 2020 02:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602667498; cv=none; d=google.com; s=arc-20160816; b=yB8bJgzBmJDktQ7RoqOhzCUlP6teChhz+z0VcVGVEIRcIRojcpEDx170TQ7taM/xEU SAROcRfjEZE996Xvu3LKkQDYWxJKAhrppsHv8tCos3AQcIPj82qpTcwBfCTcanL/b2PG l7iZaxFk2pXjNqvmC6htDFobEX5aEOLllzmZRrR1Z7cJ4D91dWlmFZOFvwXM5QYab73k LV0nx25OAHcvIOxI0DUKm52NtKNNPQdsHjItHwDt7dm253G8GhGatJ2ng9qSa8Bsdpij LGTXSHNu5cBHJvDh9YQysyDpk5BcLpvKinMF3xsPyH8V6DIBU04eTI4dzIspNLBO1jgQ 1hbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=IGLsy7zJKFsqjqav7kd9QaEQcL8Zxfhq3qOudECtU88=; b=EvxoGkkZAJR82jC16gM0chzMuikAEVcYd5y/i+dGkM9hchYfUBr711nu1wfRsUwYdN GtwAV+2HAEvl0UcmIWSsLVpGFNtOH/ine0P5adarGdua8VJxN8gDfw+GuT9VH1U9of9j eMo/gGChulDiCuGVcnSKaA+DwrffQ6LfugRA8MQ5+XIyWBENFOyGILHBF9m/BNacYCfD SCx3YURlF5Ft2ARmTHdkKngd+pQiaFrsttQ/+UXmcGubFB0MloGlujxmpImfOsinfuC3 UE/5cM0bCU9jVTyd7gF3DW8nJCYH+9sUp7vC6qvYnMT2LlyaWbdV90X0TnKlWtzDwukd M7gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZEkE2pZN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=wZINN9vN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si2041490ejb.631.2020.10.14.02.24.35; Wed, 14 Oct 2020 02:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZEkE2pZN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=wZINN9vN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730188AbgJNJVj (ORCPT + 99 others); Wed, 14 Oct 2020 05:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731014AbgJNJUk (ORCPT ); Wed, 14 Oct 2020 05:20:40 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97E3C08EAE0; Tue, 13 Oct 2020 16:42:55 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1602632574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IGLsy7zJKFsqjqav7kd9QaEQcL8Zxfhq3qOudECtU88=; b=ZEkE2pZN5e3HVrZrlnZgxzqhLHOl2ten8u6ZW/fchrROrt51iMxaKZCQFRtgM2Ahb/d0KO EIuEkNvzuxWWXSffIJRckbZ2S2IfbQw3evLTxi3owEhy0j4gkH5qy/olsT3yc4JyL68lJ0 i3/jfbY2icsxkVOuHI8R2BfW7Akxj8GrU7UTHY0olmbXthblvI/fVbCyR6LkpvnxqDnOn4 fTlMHtA4sN3VgmDbxvwzuN97Z8ef4ygUosfvacKVu2H2mwnWZ0Z+ikpXB//YoIL+zzy0ST xQ0RLPR3zKJx+TBSSL1/U7KDB4GuH7Wwjnx0GpabWRALdqGfF9dQxn+Svc0Iew== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1602632574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IGLsy7zJKFsqjqav7kd9QaEQcL8Zxfhq3qOudECtU88=; b=wZINN9vNra5AzI4Mku/3oxHq3yM3IDlJvL68r8e3ye+6rkFumuUuBlt9dZ7dHODXs2NtBu vOyADYUjMkpPsuCw== To: Jens Axboe , linux-kernel@vger.kernel.org, io-uring@vger.kernel.org Cc: peterz@infradead.org, oleg@redhat.com, Jens Axboe Subject: Re: [PATCH 3/4] kernel: add support for TIF_NOTIFY_SIGNAL In-Reply-To: <20201008152752.218889-4-axboe@kernel.dk> References: <20201008152752.218889-1-axboe@kernel.dk> <20201008152752.218889-4-axboe@kernel.dk> Date: Wed, 14 Oct 2020 01:42:53 +0200 Message-ID: <878sc9d75u.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08 2020 at 09:27, Jens Axboe wrote: > This adds TIF_NOTIFY_SIGNAL handling in the generic code, which if set, > will return true if signal_pending() is used in a wait loop. That causes > an exit of the loop so that notify_signal tracehooks can be run. If the > wait loop is currently inside a system call, the system call is restarted > once task_work has been processed. > > x86 is using the generic entry code, add the necessary TIF_NOTIFY_SIGNAL > definitions for it. Can you please split that into core changes and a patch which adds support for x86? > static inline int signal_pending(struct task_struct *p) > { > +#ifdef TIF_NOTIFY_SIGNAL As I said in the other thread, plase make this #if defined(CONFIG_GENERIC_ENTRY) && defined(TIF_NOTIFY_SIGNAL) > +/* > + * called by exit_to_user_mode_loop() if ti_work & _TIF_NOTIFY_SIGNAL. This > + * is currently used by TWA_SIGNAL based task_work, which requires breaking > + * wait loops to ensure that task_work is noticed and run. > + */ > +static inline void tracehook_notify_signal(void) > +{ > +#ifdef TIF_NOTIFY_SIGNAL Ditto. > + clear_thread_flag(TIF_NOTIFY_SIGNAL); > + smp_mb__after_atomic(); > + if (current->task_works) > + task_work_run(); > +#endif > +} > + > +/* > + * Called when we have work to process from exit_to_user_mode_loop() > + */ > +static inline void set_notify_signal(struct task_struct *task) > +{ > +#ifdef TIF_NOTIFY_SIGNAL And this one. Other than that, this approach of using arch_do_signal() addresses my earlier concerns about the syscall restart machinery. Thanks, tglx