From owner-svn-src-all@freebsd.org Wed Apr 25 00:37:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EFA8FB8D29; Wed, 25 Apr 2018 00:37:47 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9A1DE6BC64; Wed, 25 Apr 2018 00:37:46 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f171.google.com with SMTP id d6-v6so24915583iog.1; Tue, 24 Apr 2018 17:37:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=Bys0zq9z/TU4jShK95oIeQ5q6dfC3fyi35cdL+hU958=; b=Cn2Q9/F2tTWByTfaCu/viMZ2StCdwtsQ9mIdsn3rshMt97oj/nD6c1nEvhMP7hbaJD cwnLfXCsB3vqoLNdsA0Xn0hNRMsbdGsXfaKDiNGxRtZGXQyYinqgqQA9/VlQDVNPeHrr p0pXU4SOrPDN4HxA+duw6ipTyTeL4VO47cjoX9Q6UHF8btWGle+DRz2j0Jbef6Ggb3yi Sc03gaFebHDh6CMcwfb2bGRxxG8wLsA7f0dirfiYqEv4q60BMY2tErts2kzNtzSrHtes R3C3AE7Dh1K8MfapGcPhZdL1wDR7JK/OHmN2Y1khYk+9xV5/TnpEnccwcKSAh65hqksi Q1sA== X-Gm-Message-State: ALQs6tCGu9hbBMB57lWFOz4kPaWn0PGqL1JD3lllWb3EbZvOzMV7O0c4 KChVhv3wMUquNqa44+HWMsDTfGrN X-Google-Smtp-Source: AB8JxZpI9n6QcnF0ClI+n10BtbJr/jiuEj20fREshmPp1ISXZj/r0JP0BdPJtmEF/mdijrGZV4G+5w== X-Received: by 2002:a6b:2f1e:: with SMTP id j30-v6mr27499255ioo.222.1524614744868; Tue, 24 Apr 2018 17:05:44 -0700 (PDT) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com. [209.85.223.170]) by smtp.gmail.com with ESMTPSA id n142-v6sm6047638itn.38.2018.04.24.17.05.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 17:05:44 -0700 (PDT) Received: by mail-io0-f170.google.com with SMTP id t23-v6so11876616ioc.10; Tue, 24 Apr 2018 17:05:44 -0700 (PDT) X-Received: by 2002:a6b:da04:: with SMTP id x4-v6mr19248152iob.19.1524614744313; Tue, 24 Apr 2018 17:05:44 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:224d:0:0:0:0:0 with HTTP; Tue, 24 Apr 2018 17:05:43 -0700 (PDT) In-Reply-To: References: <201804241841.w3OIfE0U074131@repo.freebsd.org> From: Conrad Meyer Date: Tue, 24 Apr 2018 17:05:43 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332957 - head/sys/kern To: Mateusz Guzik Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 00:37:47 -0000 I am fine with any optimization to this path you like, so long as locks are neutered in panic and don't cause secondary panics. On Tue, Apr 24, 2018 at 4:22 PM, Mateusz Guzik wrote: > On Tue, Apr 24, 2018 at 8:41 PM, Conrad Meyer wrote: >> >> Author: cem >> Date: Tue Apr 24 18:41:14 2018 >> New Revision: 332957 >> URL: https://svnweb.freebsd.org/changeset/base/332957 >> >> Log: >> lockmgr: Add missed neutering during panic >> >> r313683 introduced new lockmgr APIs that missed the panic-time neutering >> present in the rest of our locks. Correct that by adding the usual >> check. >> >> Additionally, move the __lockmgr_args neutering above the assertions at >> the >> top of the function. Drop the interlock unlock because we shouldn't >> have >> an unneutered interlock either. No point trying to unlock it. >> >> PR: 227749 >> Reported by: jtl >> Sponsored by: Dell EMC Isilon >> >> Modified: >> head/sys/kern/kern_lock.c >> >> Modified: head/sys/kern/kern_lock.c >> >> ============================================================================== >> --- head/sys/kern/kern_lock.c Tue Apr 24 18:19:30 2018 (r332956) >> +++ head/sys/kern/kern_lock.c Tue Apr 24 18:41:14 2018 (r332957) >> @@ -918,6 +918,9 @@ lockmgr_lock_fast_path(struct lock *lk, u_int flags, s >> u_int op; >> bool locked; >> >> + if (__predict_false(panicstr != NULL)) >> + return (0); >> + >> > > This only further pollutes the slowpath. I mean fastpath. All the fallback > funcs check for panic, so there is no need to do it in regular kernels at > this level. > > Instead, the firing assertion should also see if perhaps the kernel > already has panicked. > > Alternatively, the checks added here can be conditional on INVARIANTS. > > -- > Mateusz Guzik