From owner-dev-commits-src-main@freebsd.org Mon Feb 1 05:02:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 419CF4F872F; Mon, 1 Feb 2021 05:02:26 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTbR60r64z3jBv; Mon, 1 Feb 2021 05:02:26 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x432.google.com with SMTP id 7so15157008wrz.0; Sun, 31 Jan 2021 21:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GDPRJ6jy/PSlUOykqXLo0BG9UpoAFHbEQDe8G+sN4ak=; b=XbBfiqe0GxEck3HY6NusRoKORQ+EpfuzgDwtgAqzAkctkfYXM31THXiT668Cy/F8rv mgKZr+tyefQIZ2uYUMIMiSQt4deJoqfACnFXN9DXdNO+0QhK2IFJjcwt1Eofm840t+eN 9hfY5stUPDayXSzHtt7tTa02DrS8ngMbjEiLMWgITWuGPwe543CDdwdEJqFpS1eQ0RvG FRxDuyfgJp9/r2ePVVzLjAqtqgP9bdySVC5lDVOBM7t3yMsjtxafm7uCaHcf47ynzSJ7 uDcuaXGJwfhK8Oz0gThGa+VsRBkPqIoeE9v9XmyCUVhXBol+2FbflX8rknYjBA+Fi78I TV5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GDPRJ6jy/PSlUOykqXLo0BG9UpoAFHbEQDe8G+sN4ak=; b=TE6W/11xqMamdN1lvazUQLlD5LGQWy6yAKSPQz5m1wlMR079nDdqsdAhl1FOYS3rrc TDnqWCzeL4Obi6HP/QNbkA5Ry2TU5Dy2w+zhZhACJmUFIqOBhGc7cnjczimIW40gN4E+ 9lxKuyT+y9kNdsguA/4lmUjsTdLhtvrqcdn4KzxoYCldPllxl3FATS++yCNrgcz39/oR rv7rkXnKs8YhyUArvFNBhtTI3FhLU1Q28d/bc0ilR9U/MdCnsZZcvTAFl2iQkDwgcqQI FXIeeLQNmCZ5dgifrYA5p+f0r2gpqvAqsirNNiy6mViEF+oq4tbtcgFer9ovaUUTmEFN ZI0g== X-Gm-Message-State: AOAM5328lIvifPCqXH09kuGktBlO6ymlGWSIUMg8RlMzGZPxNNggIi+B PIYOQh4yeMJR75UPy0YjBjkEaVxnX/J7kkVewSPcS/ktT+E= X-Google-Smtp-Source: ABdhPJx3d4UGo5EeVl3/N+NuiLPVTKy1XAtxHs8KcIBB1ctFsomamfyA7tLUwbHJEAkR/HJZ8f/gk/A1o4vTQuJ0AMc= X-Received: by 2002:adf:e511:: with SMTP id j17mr16100257wrm.17.1612155743695; Sun, 31 Jan 2021 21:02:23 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Sun, 31 Jan 2021 21:02:22 -0800 (PST) In-Reply-To: <202101312144.10VLiwhn025787@gitrepo.freebsd.org> References: <202101312144.10VLiwhn025787@gitrepo.freebsd.org> From: Mateusz Guzik Date: Mon, 1 Feb 2021 06:02:22 +0100 Message-ID: Subject: Re: git: e0a0a3efcb09 - main - mips: fix early kernel panic when setting up interrupt counters To: Oleksandr Tymoshenko Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DTbR60r64z3jBv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 05:02:26 -0000 This breaks building mips XLP64: linking kernel.full ld: error: undefined symbol: intrcnt >>> referenced by kern_clock.c:813 (/usr/src/sys/kern/kern_clock.c:813) >>> kern_clock.o:(hardclock) >>> referenced by kern_clock.c:813 (/usr/src/sys/kern/kern_clock.c:813) >>> kern_clock.o:(hardclock) >>> referenced by kern_clock.c:813 (/usr/src/sys/kern/kern_clock.c:813) >>> kern_clock.o:(hardclock) >>> referenced 21 more times and so on On 1/31/21, Oleksandr Tymoshenko wrote: > The branch main has been updated by gonzo: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=e0a0a3efcb09a10ad1de29aca622ea580b2663d2 > > commit e0a0a3efcb09a10ad1de29aca622ea580b2663d2 > Author: Oleksandr Tymoshenko > AuthorDate: 2021-01-30 06:11:24 +0000 > Commit: Oleksandr Tymoshenko > CommitDate: 2021-01-31 21:44:45 +0000 > > mips: fix early kernel panic when setting up interrupt counters > > Commit 248f0ca converted intrcnt and intrnames from u_long[] > and char[] to u_long* and char* respectively, but for non-INTRNG mips > these symbols were defined in .S file as a pre-allocated static arrays, > so the problem wasn't cought at compile time. Conversion from an array > to a pointer requires pointer initialization and it wasn't done > for MIPS, so whatever happenned to be in the begginning of intcnt[] > array was used as a pointer value. > > Move intrcnt/intrnames to C code and allocate them dynamically > although with a fixed size at the moment. > > Reviewed by: emaste > PR: 253051 > Differential Revision: https://reviews.freebsd.org/D28424 > MFC after: 1 day > --- > sys/mips/mips/exception.S | 36 ------------------------------------ > sys/mips/mips/intr_machdep.c | 22 ++++++++++++++++++++++ > 2 files changed, 22 insertions(+), 36 deletions(-) > > diff --git a/sys/mips/mips/exception.S b/sys/mips/mips/exception.S > index 892bebc8f37f..719904ac83b7 100644 > --- a/sys/mips/mips/exception.S > +++ b/sys/mips/mips/exception.S > @@ -80,12 +80,6 @@ dtrace_invop_calltrap_addr: > .text > #endif > > -/* > - * Reasonable limit > - */ > -#define INTRCNT_COUNT 256 > - > - > /* > > *---------------------------------------------------------------------------- > * > @@ -1206,36 +1200,6 @@ FPReturn: > .set pop > END(MipsFPTrap) > > -#ifndef INTRNG > -/* > - * Interrupt counters for vmstat. > - */ > - .data > - .globl intrcnt > - .globl sintrcnt > - .globl intrnames > - .globl sintrnames > -intrnames: > - .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 > -sintrnames: > -#ifdef __mips_n64 > - .quad INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 > -#else > - .int INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 > -#endif > - > - .align (_MIPS_SZLONG / 8) > -intrcnt: > - .space INTRCNT_COUNT * (_MIPS_SZLONG / 8) * 2 > -sintrcnt: > -#ifdef __mips_n64 > - .quad INTRCNT_COUNT * (_MIPS_SZLONG / 8) * 2 > -#else > - .int INTRCNT_COUNT * (_MIPS_SZLONG / 8) * 2 > -#endif > -#endif /* INTRNG */ > - > - > /* > * Vector to real handler in KSEG1. > */ > diff --git a/sys/mips/mips/intr_machdep.c b/sys/mips/mips/intr_machdep.c > index 3b278276865c..a36944f657ca 100644 > --- a/sys/mips/mips/intr_machdep.c > +++ b/sys/mips/mips/intr_machdep.c > @@ -50,6 +50,19 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#ifndef INTRNG > +#define INTRCNT_COUNT 256 > +#define INTRNAME_LEN (2*MAXCOMLEN + 1) > + > +MALLOC_DECLARE(M_MIPSINTR); > +MALLOC_DEFINE(M_MIPSINTR, "mipsintr", "MIPS interrupt handling"); > + > +u_long *intrcnt; > +char *intrnames; > +size_t sintrcnt; > +size_t sintrnames; > +#endif > + > static struct intr_event *hardintr_events[NHARD_IRQS]; > static struct intr_event *softintr_events[NSOFT_IRQS]; > static mips_intrcnt_t mips_intr_counters[NSOFT_IRQS + NHARD_IRQS]; > @@ -121,6 +134,15 @@ cpu_init_interrupts() > int i; > char name[MAXCOMLEN + 1]; > > +#ifndef INTRNG > + intrcnt = mallocarray(INTRCNT_COUNT, sizeof(u_long), M_MIPSINTR, > + M_WAITOK | M_ZERO); > + intrnames = mallocarray(INTRCNT_COUNT, INTRNAME_LEN, M_MIPSINTR, > + M_WAITOK | M_ZERO); > + sintrcnt = INTRCNT_COUNT * sizeof(u_long); > + sintrnames = INTRCNT_COUNT * INTRNAME_LEN; > +#endif > + > /* > * Initialize all available vectors so spare IRQ > * would show up in systat output > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to > "dev-commits-src-all-unsubscribe@freebsd.org" > -- Mateusz Guzik