Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3009953imm; Fri, 19 Oct 2018 03:39:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV62RKdRR0kmTHH2Yxb6zlq+CZE5Yva/AHIotmLx5QN0ofH0Ie34oS2dYMJM2AvpXtNQ2Zx78 X-Received: by 2002:a62:75c7:: with SMTP id q190-v6mr34438646pfc.137.1539945578059; Fri, 19 Oct 2018 03:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539945578; cv=none; d=google.com; s=arc-20160816; b=WcHQos40dtM2UGKCpUL9oNjEqs++nTRz5U2h2Tsl38MWvUsUpIOx5/rR/96eCBGUlK 71KNsWkV0L7lOGN13Ho4bvQ5Ms2jEBPzmQuNYCto71TYRSzK/d72dg9o4h1DhFBfUwD+ /fA9aVMl1tyFdHDzsdixfPbf7KRn3LxwEllzrAF7xfduuvNkWL45O75YibhluS651pXM vph4LLWKqucw44YfXa/oIOTNA8lzuvXEyr7+Ru0FXe9k4iOiPAm9ZSRlyZViwGtPdPZ/ AGCBA0lgnbqOjWVS2ju+HXZQ5KF3F0UFjav5YW8uFiQGourDkWzsq7B3m4gG4QQGLXRR EE5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NaTGHceZigEh756riYvFcN+qbBBV+dgabq5oxH9FKoY=; b=dRz/DxHYPAgBf7T87TilYCwJmKqpJIMSU7TXWlDND3nUXCZFX3zO8e1GdtO6ulWFi+ i0yyKL+NK5i5EVcWkMkBQkfFe6gdbqKrTJtZYX5CeLpEBYvvfA+I9EEVKfYxxF+45Lwf PHwSR0eBGE95jNnkXIy5MZaAY1cJiA3p0074uIP71AjZQZi52gnOC3hY+6kL9OtiwZSC 5Z8SU0r+cTjD8gFe8YHxNuANwa8xrw99ZZvkA06c7wBpKKQYYPsOpzvWHV2SL3wud60y txtQHSa/0ImdQbyNv1BFbNBEnkjfFvNPIq02/4vscPgdkR8ilY+txqSm7qaXSiUT/OLB cVPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10-v6si23816298pgg.216.2018.10.19.03.39.22; Fri, 19 Oct 2018 03:39:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727378AbeJSSno (ORCPT + 99 others); Fri, 19 Oct 2018 14:43:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbeJSSno (ORCPT ); Fri, 19 Oct 2018 14:43:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AFB6C050DF2; Fri, 19 Oct 2018 10:38:14 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.106]) by smtp.corp.redhat.com (Postfix) with SMTP id 609C117B6E; Fri, 19 Oct 2018 10:38:12 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 19 Oct 2018 12:38:13 +0200 (CEST) Date: Fri, 19 Oct 2018 12:38:10 +0200 From: Oleg Nesterov To: Andy Lutomirski Cc: Nadav Amit , Alexei Starovoitov , Ingo Molnar , Peter Zijlstra , "H. Peter Anvin" , Thomas Gleixner , LKML , X86 ML , Borislav Petkov , "Woodhouse, David" Subject: Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix Message-ID: <20181019103810.GA23194@redhat.com> References: <20181018005420.82993-1-namit@vmware.com> <20181018005420.82993-2-namit@vmware.com> <07255D2B-0243-4254-B62A-37050C44207E@vmware.com> <925F22EA-F8CB-4194-B96B-378409ED7918@vmware.com> <2626124E-7344-42F3-AD07-0BB34D62A9EE@amacapital.net> <6F1FD9DA-5E86-42A2-8EAF-05F5D70FE2EF@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 19 Oct 2018 10:38:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/18, Andy Lutomirski wrote: > > Oleg, the code in kernel/signal.c: > > preempt_disable(); > read_unlock(&tasklist_lock); > preempt_enable_no_resched(); > freezable_schedule(); > > looks bogus. I don't get what it's trying to achieve with > preempt_disable(), and I also don't see why no_resched does anything. > Sure, it prevents a reschedule triggered during read_unlock() from > causing a reschedule, Yes. Lets suppose we remove preempt_disable/enable. Debugger was already woken up, if it runs on the same CPU quite possibly it will preemt the tracee. After that debugger will spin in wait_task_inactive(), until it is in turn preempted or calls schedule_timeout(1), so that the tracee (current) can finally call __schedule(preempt = F) and call deactivate_task() to become inactive. > but it doesn't prevent an interrupt immediately > after the preempt_enable_no_resched() call from scheduling. Yes, but this is less likely. Oleg.