[PATCH 1/2] kexec: Default __NR_kexec_file_load is set to undefined

Philipp Rudo prudo at redhat.com
Fri Mar 3 03:03:19 PST 2023


Hi Baoquan,

On Tue, 28 Feb 2023 21:32:26 +0800
Baoquan He <bhe at redhat.com> wrote:

> Hi Philipp,
> 
> On 02/27/23 at 04:19pm, Philipp Rudo wrote:
> ...... 
> > > diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
> > > index be6ccd5..ea77936 100644
> > > --- a/kexec/kexec-syscall.h
> > > +++ b/kexec/kexec-syscall.h
> > > @@ -59,9 +59,7 @@
> > >  #endif
> > >  #endif /*ifndef __NR_kexec_load*/
> > >  
> > > -#ifdef __arm__
> > >  #undef __NR_kexec_file_load
> > > -#endif
> > >  
> > >  #ifndef __NR_kexec_file_load  
> > 
> > I don't think this will work as intended. 
> > 
> > On the top of the file sys/syscall.h gets included. In there
> > architectures that support kexec_file_load define __NR_kexec_file_load.
> > This also means that if an architecture doesn't support kexec_file_load
> > __NR_kexec_file_load shouldn't be defined in the first place. Thus I
> > suggest that you find out why sys/syscall.h defines
> > __NR_kexec_file_load for LoongArch even when the system call is not
> > supported and fix it there.  
> 
> Checking whether LoongArch has defined __NR_kexec_file_load sounds a
> good suggestion. Wondering why we still need add __NR_kexec_file_load
> definition in kexec-tools. E.g below s390 kexec_file support you added.
> <sys/syscall.h> sometime won't be found or __NR_kexec_file_load could be
> not defined yet?
> 
> commit d4a948c268272cf37c71be820fb02bf40e56292b
> Author: Philipp Rudo <prudo at linux.ibm.com>
> Date:   Wed May 16 14:27:18 2018 +0200
> 
>     kexec/s390: Add support for kexec_file_load
> 

To be honest I don't remember why I have added it back then. Most
likely I simply copied what others have done before.

The benefit in having the extra definition I see is that you don't need
to rebuild glibc when you implement the syscall and don't use the
generic unistd.h. But that is something only few people should ever
encounter.

Thanks
Philipp




More information about the kexec mailing list