From nobody Thu Sep 22 19:07:08 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MYPsp5ycrz4d47N for ; Thu, 22 Sep 2022 19:07:10 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MYPsp32yWz3jMF; Thu, 22 Sep 2022 19:07:10 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oi1-x236.google.com with SMTP id v130so13622028oie.2; Thu, 22 Sep 2022 12:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date; bh=LuQkMHT2CIEungGaWtcwBCHNiMRtB504iKdVte5fI6M=; b=eB9H8p6ceYkNzF3rMrbFJ5lQztUpJZAVP/nopLAmcWBRJGxATQ2nP5uaPk5HHWii5e MHBCAlhJhJ6z3qYVLVuoAvrOECNzqOU3F0OyQ1p2V7Qq1v13/ha3Qqpm6b7yS/kBTqJB bOuoCITUcqINV8kAnlGhohrEPSsB0kLh/TLZPxUsTK4xr+r94nA1tdufw/ux0odhsx9q W7iF1JQJSSy2VpjUaaSZGViNZTw8NL6pymbVkEpBg6h+FHgcV1GGhW6TXzO4f+BZWKsW 646P2nZSfOjXOpiXfnmMc+8qU4/Ds9J1RPrVwPMIZNfUXV9WwrBrL1sEHjNBO3+7AUx6 xBKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=LuQkMHT2CIEungGaWtcwBCHNiMRtB504iKdVte5fI6M=; b=Mo3wGxPW6TQBkfLSgjyZj+PMrGKLIsSHb2TOa4ZE0Rsrosq/md3p/o3yHNKsYm8ggG /wPXFLfXjqpMHBFds0iEpw9NSqiN9A5MwwIGp+sU6C8BbYgKIGXU21wZhM+7/MAAX8MM gral1x92cufDd+pBlho7Jjh3MnS5/W0znLJKTY4ZLaC0rrNMOHjxFHl7ihV7Msuve2oY KUubz0ZP1zXTbcekFnqdFoybk3IYeWfhbU3DeIwg8MtcCfn/eXQr0E8nRBIgA+hvS9m5 XcBdLkWiqvlO3L2X4d6Ja+trx5ptDeF4q14JxYSdVjbtHRuTeCmpbft+gLiCSEz7iMat Tc3w== X-Gm-Message-State: ACrzQf0WHuDBvJGdiVvlRFYbRVwtbt4xjva2zXw0rJTJKG3lz8CNzzTD FYKGBHaEuCUlXMJQxHxMK59eKaxcnIs70JA9xB26ig2L X-Google-Smtp-Source: AMsMyM5SU9xff/gPZg1ZfExMq/fUjnQkaoLgUG9jfpiEXJn0qzoS1d79hn3WKf5RW+uCD2Sy7AwPiPpNjFdUcNYsYgk= X-Received: by 2002:a05:6808:2390:b0:350:5c6b:5ef9 with SMTP id bp16-20020a056808239000b003505c6b5ef9mr2397360oib.96.1663873629642; Thu, 22 Sep 2022 12:07:09 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Received: by 2002:a8a:352:0:b0:474:267f:5338 with HTTP; Thu, 22 Sep 2022 12:07:08 -0700 (PDT) In-Reply-To: References: From: Mateusz Guzik Date: Thu, 22 Sep 2022 21:07:08 +0200 Message-ID: Subject: Re: A panic a day To: sgk@troutmask.apl.washington.edu Cc: Mark Johnston , freebsd-current@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4MYPsp32yWz3jMF X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=eB9H8p6c; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2607:f8b0:4864:20::236 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.78 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.984]; NEURAL_HAM_MEDIUM(-0.79)[-0.793]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::236:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N On 9/22/22, Steve Kargl wrote: > On Thu, Sep 22, 2022 at 03:00:53PM -0400, Mark Johnston wrote: >> On Thu, Sep 22, 2022 at 11:31:40AM -0700, Steve Kargl wrote: >> > All, >> > >> > I updated my kernel/world/all ports on Sept 19 2022. >> > Since then, I have had daily panics and hard lock-up >> > (no panic, keyboard, mouse, network, ...). The one >> > panic I did witness sent text scolling off the screen. >> > There is no dump, or at least, I haven't figured out >> > a way to get a dump. >> > >> > Using ports/graphics/tesseract and then hand editing >> > the OCR result, the last visible portions is >> > >> > > > (panic messages removed). > >> It looks like you use the 4BSD scheduler? I think there's a bug in >> kick_other_cpu() in that it doesn't make sure that the remote CPU's >> curthread lock is held when modifying thread state. Because 4BSD has a >> global scheduler lock, this is often true in practice, but doesn't have >> to be. > > Yes, I use 4BSD. ULE has very poor performance for HPC type work with > OpenMPI. > Is there an easy way to set it up for testing purposes? >> I think this untested patch will address the panics. The bug was there >> for a long time but some recent restructuring added an assertion which >> caught it. > > I'll give it a try, and report back. Thanks! > > -- > steve > >> diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c >> index 9d48aa746f6d..484864b66c1c 100644 >> --- a/sys/kern/sched_4bsd.c >> +++ b/sys/kern/sched_4bsd.c >> @@ -1282,9 +1282,10 @@ kick_other_cpu(int pri, int cpuid) >> } >> #endif /* defined(IPI_PREEMPTION) && defined(PREEMPTION) */ >> >> - ast_sched_locked(pcpu->pc_curthread, TDA_SCHED); >> - ipi_cpu(cpuid, IPI_AST); >> - return; >> + if (pcpu->pc_curthread->td_lock == &sched_lock) { >> + ast_sched_locked(pcpu->pc_curthread, TDA_SCHED); >> + ipi_cpu(cpuid, IPI_AST); >> + } >> } >> #endif /* SMP */ >> >> @@ -1397,7 +1398,7 @@ sched_add(struct thread *td, int flags) >> >> cpuid = PCPU_GET(cpuid); >> if (single_cpu && cpu != cpuid) { >> - kick_other_cpu(td->td_priority, cpu); >> + kick_other_cpu(td->td_priority, cpu); >> } else { >> if (!single_cpu) { >> tidlemsk = idle_cpus_mask; > > -- > Steve > > -- Mateusz Guzik