Ticket 8602 - patches for freebsd build
Summary: patches for freebsd build
Status: OPEN
Alias: None
Product: Slurm
Classification: Unclassified
Component: Build System and Packaging (show other tickets)
Version: 20.02.1
Hardware: All Other
: C - Contributions
Assignee: Tim Wickberg
QA Contact:
URL:
: 5792 (view as ticket list)
Depends on:
Blocks:
 
Reported: 2020-02-29 17:48 MST by Moe Jette
Modified: 2020-04-15 06:00 MDT (History)
2 users (show)

See Also:
Site: -Other-
Alineos Sites: ---
Atos/Eviden Sites: ---
Confidential Site: ---
Coreweave sites: ---
Cray Sites: ---
DS9 clusters: ---
HPCnow Sites: ---
HPE Sites: ---
IBM Sites: ---
NOAA SIte: ---
NoveTech Sites: ---
Nvidia HWinf-CS Sites: ---
OCF Sites: ---
Recursion Pharma Sites: ---
SFW Sites: ---
SNIC sites: ---
Tzag Elita Sites: ---
Linux Distro: ---
Machine Name:
CLE Version:
Version Fixed: 20.02.2
Target Release: ---
DevPrio: ---
Emory-Cloud Sites: ---


Attachments
Fix for src/api build (311 bytes, patch)
2020-02-29 17:48 MST, Moe Jette
Details | Diff
patch for src/plugins/switch/cray_aries build (344 bytes, patch)
2020-02-29 17:49 MST, Moe Jette
Details | Diff
patch to src/sru/libsrun for freebsd build (307 bytes, patch)
2020-02-29 17:51 MST, Moe Jette
Details | Diff
patch for src/plugins/cli_filter/user_defaults/cli_filter_user_defaults.c (342 bytes, patch)
2020-04-03 18:41 MDT, Jason Bacon
Details | Diff
patch for src/plugins/mpi/cray_shasta/mpi_cray_shasta.c (272 bytes, patch)
2020-04-03 18:42 MDT, Jason Bacon
Details | Diff
patch for src/plugins/proctrack/pgid/proctrack_pgid.c (3.34 KB, patch)
2020-04-03 18:45 MDT, Jason Bacon
Details | Diff
patch for src/slurmctld/prep_slurmctld.c (402 bytes, patch)
2020-04-03 18:46 MDT, Jason Bacon
Details | Diff
FreeBSD version of proctrack_p_get_pids() (2.41 KB, patch)
2020-04-09 15:26 MDT, Tim Wickberg
Details | Diff

Note You need to log in before you can comment on or make changes to this ticket.
Description Moe Jette 2020-02-29 17:48:30 MST
Created attachment 13226 [details]
Fix for src/api build
Comment 1 Moe Jette 2020-02-29 17:49:25 MST
Created attachment 13227 [details]
patch for src/plugins/switch/cray_aries build
Comment 2 Moe Jette 2020-02-29 17:51:02 MST
Created attachment 13228 [details]
patch to src/sru/libsrun for freebsd build
Comment 3 Moe Jette 2020-02-29 17:52:45 MST
The author for these patches is:
Jason Bacon <bacon4000@gmail.com>

His message is as follows:
I got a report from another developer that the Makefile.in patch fixes
an undefined symbol issue with clang 10.  I have not looked that closely
at it, but just confirmed that it doesn't break anything for clang 8.
Comment 4 Jason Bacon 2020-04-03 18:41:52 MDT
Created attachment 13608 [details]
patch for src/plugins/cli_filter/user_defaults/cli_filter_user_defaults.c
Comment 5 Jason Bacon 2020-04-03 18:42:43 MDT
Created attachment 13609 [details]
patch for src/plugins/mpi/cray_shasta/mpi_cray_shasta.c
Comment 6 Jason Bacon 2020-04-03 18:45:27 MDT
Created attachment 13610 [details]
patch for src/plugins/proctrack/pgid/proctrack_pgid.c

Relieves unconditional dependence on linux procfs mount.
Linux procfs is still required for jobacct_gather/linux to function on FreeBSD.
Comment 7 Jason Bacon 2020-04-03 18:46:11 MDT
Created attachment 13611 [details]
patch for src/slurmctld/prep_slurmctld.c
Comment 8 Jason Bacon 2020-04-03 18:47:47 MDT
*** Ticket 5792 has been marked as a duplicate of this ticket. ***
Comment 9 Jason Bacon 2020-04-03 18:56:24 MDT
Updated to include a full set of patches for 20.02.1.
Also eliminated unconditional dependence on Linux procfs by adding code utilizing FreeBSD's libprocstat.  Linux procfs will still be necessary for users who want to use jobacct_gather/linux.
Comment 10 Tim Wickberg 2020-04-09 13:30:53 MDT
Thanks Jason. I'm starting to work through getting these in ahead of 20.02.2, and a few of them have been pushed already (I'll mark the corresponding attachments as obsolete in a second).

commit f854ebfa31b27a4ca6beb64d2319b42bcd1fdd42
Author:     Jason Bacon <bacon4000@gmail.com>
AuthorDate: Thu Apr 9 13:18:20 2020 -0600

    Add missing signal.h include.
    
    Needed on FreeBSD.
    
    Bug 8602.

commit ac69a9f0af867212435a57287abe00efb811e599
Author:     Jason Bacon <bacon4000@gmail.com>
AuthorDate: Thu Apr 9 13:05:47 2020 -0600

    Add missing limits.h include.
    
    Needed on FreeBSD.
    
    Bug 8602.
Comment 11 Tim Wickberg 2020-04-09 15:11:55 MDT
Comment on attachment 13227 [details]
patch for src/plugins/switch/cray_aries build

The switch/cray_aries plugin no longer builds by default, and thus this patch should not be necessary.
Comment 12 Tim Wickberg 2020-04-09 15:15:02 MDT
Comment on attachment 13228 [details]
patch to src/sru/libsrun for freebsd build

This was addressed before 19.05 was released with the following commit:

commit 83b4d70a00b7d6dc05bd1c38b14f17d87dae0a4d
Author:     Tim Wickberg <tim@schedmd.com>
AuthorDate: Thu Jan 3 22:22:57 2019 -0700

    Replace __environ with environ.
    
    Declare as extern; the linker will find this in libc somewhere.
    
    Bug 5561.
Comment 13 Tim Wickberg 2020-04-09 15:26:04 MDT
Created attachment 13698 [details]
FreeBSD version of proctrack_p_get_pids()

Jason -

Do you mind testing this? It's your FreeBSD version of the proctrack_p_get_pids() after tweaking the style to match the current conventions, and should be functionally identical to what you'd submitted.

thanks,
- Tim
Comment 14 Tim Wickberg 2020-04-09 16:03:49 MDT
Comment on attachment 13226 [details]
Fix for src/api build

commit 6eeae2bc7b94c897513f10ed6cac32e762f2f170
Author:     Jason Bacon <bacon4000@gmail.com>
AuthorDate: Thu Apr 9 16:01:28 2020 -0600

    Simplify version map for libslurmfull.
    
    Everything is already exported under global, so a wildcard for local
    does nothing. (Except break the build for FreeBSD with LLVM 10.0.)
    
    Bug 8602.
Comment 15 Tim Wickberg 2020-04-09 16:04:40 MDT
Thanks Jason. These are all in ahead of 20.02.2 with the exception of the proctrack/pgid patch as mentioned in comment 13. If you can verify I did not break that on review I'll get that pushed, and get this ticket closed out.

thanks again,
- Tim
Comment 16 Jason Bacon 2020-04-09 19:37:00 MDT
Hi Tim,

Thanks for your work on this.  It seems your changes did break something.  With your new patch, jobs are hanging at completion.  Reverting to my old patch made the issue go away.

I'll have a closer look ASAP to see if I can spot any key differences.

Best,

   JB
Comment 17 Jason Bacon 2020-04-10 07:19:16 MDT
(In reply to Tim Wickberg from comment #13)
> Created attachment 13698 [details]
> FreeBSD version of proctrack_p_get_pids()
> 
> Jason -
> 
> Do you mind testing this? It's your FreeBSD version of the
> proctrack_p_get_pids() after tweaking the style to match the current
> conventions, and should be functionally identical to what you'd submitted.
> 
> thanks,
> - Tim

You have to initialize pid_count:

-+	unsigned int pid_count;
++	unsigned int pid_count = 0;

procstat_getprocs() does not set the pid_count pointer when no matching processes are found.  This is another aspect of the function treating this case as an error.  I'll suggest in the FreeBSD PR that this might be considered a bug, though there may be a reason for the behavior that I'm not aware of.

Best,

   JB
Comment 18 Tim Wickberg 2020-04-13 16:06:09 MDT
Comment on attachment 13698 [details]
FreeBSD version of proctrack_p_get_pids()

commit 9383bf02bce104a0c9753bb444cd33beeec52d5b
Author:     Jason Bacon <bacon4000@gmail.com>
AuthorDate: Thu Apr 9 13:13:36 2020 -0600

    Add FreeBSD implementation of proctrack_p_get_pids().
    
    Bug 8602.
Comment 19 Tim Wickberg 2020-04-13 16:07:17 MDT
Thanks for all these Jason.

These are all in ahead of the 20.02.2 maintenance release, and I'm marking this issue resolved. Please reopen (or file a separate issues) if you have anything else.

- Tim
Comment 20 Jason Bacon 2020-04-15 06:00:09 MDT
Oops, sorry, one grievous oversight...  I forgot to revert the error stream to stderr after the redirect is no longer needed, which is just a matter of err_set_file(NULL).

Here's a patch:

 +      proc_list = procstat_getprocs(proc_info, KERN_PROC_PGRP, cont_id,
 +                                    (unsigned int *) &pid_count);
 +      if (procstat_err)
++      {
++              err_set_file(NULL);
 +              fclose(procstat_err);
++      }
 +
 +      if (pid_count > 0) {
 +              xrecalloc(pid_array, sizeof(pid_t), pid_count);