From owner-svn-src-head@freebsd.org Sat Mar 3 22:40:48 2018 Return-Path: Delivered-To: svn-src-head@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 DDE1FF42809; Sat, 3 Mar 2018 22:40:47 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com [209.85.214.52]) (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 7E6A87A3C0; Sat, 3 Mar 2018 22:40:47 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f52.google.com with SMTP id v194so5908056itb.0; Sat, 03 Mar 2018 14:40:47 -0800 (PST) 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=Oih+nmOfIUC2209YkDJYzHMJEEijhPkMX6myh48I/sI=; b=ktxc8mOalWN6y7P5qkWTwGxCReG74yBCtdcUTRdeHG6QjAw0jOQ7CuZHkTk951geBK 0hMH3t28nXFgnrB96wYGRVG2u7PY1ZMwRH+ItQdWuGVC4NxJCxhMXh/IsgO9TB17KRDo iCXhh0Hruykb9fdtRb7uoU9nwsr1AgUbxKybTg8FtJ1/f8t42y+58PFL8xtv4blXJmlu Vg0CLGjpyHAc/uMBhqiORVGiyx8k/w+euGP7UcFcTXErA6CQRrZ7AKNCKFTZGHdsiks2 wEj0HAOzOU1mzceKz3ct2CtF6h31Dz2ofWxkH6Rpl/hbe24ayD/pSR3bzl1Yq7CiPkkB nZfQ== X-Gm-Message-State: AElRT7E/kxxKvDFws3mjDs8RJ99wkGW2yA+Ey+fBxLGS8XemNRjaHa8N ceepf2OuqkPz74Zd1E/Imnfx5h7J X-Google-Smtp-Source: AG47ELsuMHa41u9SpoL1gGTGz0cfAc98vUu+cI33arvoj5FUm+V00NDXCr/zA9k6O98RiVEFu2Id8w== X-Received: by 10.36.244.13 with SMTP id d13mr8421041iti.110.1520116489690; Sat, 03 Mar 2018 14:34:49 -0800 (PST) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com. [209.85.223.174]) by smtp.gmail.com with ESMTPSA id i197sm5993819ioe.54.2018.03.03.14.34.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Mar 2018 14:34:49 -0800 (PST) Received: by mail-io0-f174.google.com with SMTP id f1so14242183iob.0; Sat, 03 Mar 2018 14:34:49 -0800 (PST) X-Received: by 10.107.34.80 with SMTP id i77mr11719958ioi.220.1520116489272; Sat, 03 Mar 2018 14:34:49 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.30.149 with HTTP; Sat, 3 Mar 2018 14:34:48 -0800 (PST) In-Reply-To: <201803031836.w23IacY3077188@repo.freebsd.org> References: <201803031836.w23IacY3077188@repo.freebsd.org> From: Conrad Meyer Date: Sat, 3 Mar 2018 14:34:48 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r330349 - in head/sys: kern sys To: Hans Petter Selasky Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Mar 2018 22:40:48 -0000 Please document the new ABI in the sleep(9) manual page. Thanks, Conrad On Sat, Mar 3, 2018 at 10:36 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Mar 3 18:36:38 2018 > New Revision: 330349 > URL: https://svnweb.freebsd.org/changeset/base/330349 > > Log: > Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag. > Define pause_sig() function macro helper similarly to other kernel functions > which catch signals. Update outdated function description. > > Discussed with: kib@ > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/kern/kern_synch.c > head/sys/sys/callout.h > head/sys/sys/systm.h > > Modified: head/sys/kern/kern_synch.c > ============================================================================== > --- head/sys/kern/kern_synch.c Sat Mar 3 18:30:31 2018 (r330348) > +++ head/sys/kern/kern_synch.c Sat Mar 3 18:36:38 2018 (r330349) > @@ -297,16 +297,16 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const ch > } > > /* > - * pause() delays the calling thread by the given number of system ticks. > - * During cold bootup, pause() uses the DELAY() function instead of > - * the tsleep() function to do the waiting. The "timo" argument must be > - * greater than or equal to zero. A "timo" value of zero is equivalent > - * to a "timo" value of one. > + * pause_sbt() delays the calling thread by the given signed binary > + * time. During cold bootup, pause_sbt() uses the DELAY() function > + * instead of the _sleep() function to do the waiting. The "sbt" > + * argument must be greater than or equal to zero. A "sbt" value of > + * zero is equivalent to a "sbt" value of one tick. > */ > int > pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) > { > - KASSERT(sbt >= 0, ("pause: timeout must be >= 0")); > + KASSERT(sbt >= 0, ("pause_sbt: timeout must be >= 0")); > > /* silently convert invalid timeouts */ > if (sbt == 0) > @@ -328,7 +328,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_ > DELAY(sbt); > return (EWOULDBLOCK); > } > - return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); > + return (_sleep(&pause_wchan[curcpu], NULL, > + (flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags)); > } > > /* > > Modified: head/sys/sys/callout.h > ============================================================================== > --- head/sys/sys/callout.h Sat Mar 3 18:30:31 2018 (r330348) > +++ head/sys/sys/callout.h Sat Mar 3 18:36:38 2018 (r330349) > @@ -60,6 +60,7 @@ > #define C_HARDCLOCK 0x0100 /* align to hardclock() calls */ > #define C_ABSOLUTE 0x0200 /* event time is absolute. */ > #define C_PRECALC 0x0400 /* event time is pre-calculated. */ > +#define C_CATCH 0x0800 /* catch signals, used by pause_sbt(9) */ > > struct callout_handle { > struct callout *callout; > > Modified: head/sys/sys/systm.h > ============================================================================== > --- head/sys/sys/systm.h Sat Mar 3 18:30:31 2018 (r330348) > +++ head/sys/sys/systm.h Sat Mar 3 18:36:38 2018 (r330349) > @@ -411,6 +411,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbint > int flags); > #define pause(wmesg, timo) \ > pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK) > +#define pause_sig(wmesg, timo) \ > + pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK | C_CATCH) > #define tsleep(chan, pri, wmesg, timo) \ > _sleep((chan), NULL, (pri), (wmesg), tick_sbt * (timo), \ > 0, C_HARDCLOCK) >