From owner-svn-src-projects@FreeBSD.ORG Sat Sep 8 17:14:44 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33EEB106564A; Sat, 8 Sep 2012 17:14:43 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id B5F778FC14; Sat, 8 Sep 2012 17:14:42 +0000 (UTC) Received: by lage12 with SMTP id e12so561803lag.13 for ; Sat, 08 Sep 2012 10:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=UNA3TjvBPA6J7C5MM/tPlk7GCD7w8w8czqeE2Q5R8MQ=; b=C8kf2MdR7fwIKWkypng6kVUuGMZi0Y8KMKn14Vr+PZeyOdXf3aPBCWBv6999nmAUER Q/gYT7A83Wcty33Rfl2F/+0ARfSfQXsXgXGUYdBXCOYmQkcImGZRotOJgNP7Gu2rbSvf A4/Pm/9jTVxtxoyUFx9MTH2oAjdxAU/Y1DTg/lM9LdKI90QpIvzIPZmSx8e2U4/SMzo+ AcaqPy7Z92gGpi8HH/w4CqGk33mxaFri//9+heUi1V0MepKzgxFHIQe4745JERZf3C/E IJnFPCBn7Z+SjxvMDVlcBuD7g/VI9RknhtcEg5AdP0kbHY1LP+uFOCij6rE2SwkcljYK bPuw== MIME-Version: 1.0 Received: by 10.112.86.41 with SMTP id m9mr3283690lbz.108.1347124481284; Sat, 08 Sep 2012 10:14:41 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.102.39 with HTTP; Sat, 8 Sep 2012 10:14:41 -0700 (PDT) In-Reply-To: <20120908153839.GF33100@deviant.kiev.zoral.com.ua> References: <20120730143943.GY2676@deviant.kiev.zoral.com.ua> <5016A21B.6090409@FreeBSD.org> <5016A8E4.7070405@FreeBSD.org> <20120908153839.GF33100@deviant.kiev.zoral.com.ua> Date: Sat, 8 Sep 2012 18:14:41 +0100 X-Google-Sender-Auth: kvNlmppW6E0PUQeroyxq4vce_Ag Message-ID: From: Attilio Rao To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: Davide Italiano , svn-src-projects@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r238907 - projects/calloutng/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Sep 2012 17:14:44 -0000 On Sat, Sep 8, 2012 at 4:38 PM, Konstantin Belousov wrote: > On Fri, Sep 07, 2012 at 11:35:15PM +0100, Attilio Rao wrote: >> On Mon, Jul 30, 2012 at 9:39 PM, Attilio Rao wrote: >> > On Mon, Jul 30, 2012 at 4:31 PM, Andriy Gapon wrote: >> >> on 30/07/2012 18:04 Attilio Rao said the following: >> >>> On 7/30/12, Andriy Gapon wrote: >> >>>> on 30/07/2012 17:56 Attilio Rao said the following: >> >>>>> More explicitly, I think such combination TDP_NOSLEEPING + >> >>>>> TDP_NOBLOCKING (name invented) should be set on entering the interrupt >> >>>>> context, not only related to this part of callouts. This would be a >> >>>>> very good help for catching buggy situations. >> >>>> >> >>>> Something very tangential. I think it would also be nice to check if a >> >>>> thread has >> >>>> any(?) locks held when returning to userland. >> >>> >> >>> This happens already for INVARIANTS case, with td_locks counters. >> >>> In the !INVARIANTS case, this doesn't happen because you don't want to >> >>> add the burden to bump td_locks for the fast case and I think it is a >> >>> good approach. >> >> >> >> Ah, I missed that, thank you. >> >> BTW, it seems that td_locks is checked twice in normal syscallret() path: once in >> >> syscallret() itself and then in userret(). On this note, would it make sense to >> >> move the whole nine yards of asserts from syscallret() to userret()? >> >> I mean it might make sense to have those checks (td_critnest, td_pflags) in other >> >> paths to userland. >> > >> > Nice catch. >> > The checks were added to syscallret() in r208453. While this is fine, >> > I think that putting them in userret() may give them more exposure and >> > cover also cases like traps which are not covered right now. >> > If you want to make a patch that moves these conditions in userret() >> > I'd be in favor of it. >> >> More specifically, what do you think about this patch?: >> http://www.freebsd.org/~attilio/userret_diag.patch >> >> Of course I moved the XEN par too before the checks. >> The patch survived to few consecutive and parallel buildworlds, FWIW. > > At least in fork_return(), the last assert which checks that Giant is not > held, is no longer needed. Actually, this is unnecessary also with -CURRENT stock code today, because userret() already checks for td_locks. And it seems fork_return() is not the only function where this happens, as trap() did this too on x86 and possibly all the other architectures grew it with cut&paste. Possibly we need this further, separate, patch before userred_diag: http://www.freebsd.org/~attilio/userret_nogiant.patch > I had similar thought from the time when I added TDP_NOFAULTING check to the > syscallret(), but the loss of the syscall name in the panic output always > stopped me. I think in case of a lock/td_pinned/td_critnest/etc. leak, having the syscall number in the panic message won't change anything as you will likely need a coredump and possibly instrument your kernel with further debugging, etc. to see what's going on. Attilio -- Peace can only be achieved by understanding - A. Einstein