Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbdHPNkr (ORCPT ); Wed, 16 Aug 2017 09:40:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56092 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbdHPNkp (ORCPT ); Wed, 16 Aug 2017 09:40:45 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5E68D40242 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=joe.lawrence@redhat.com Subject: Re: [PATCH v4] livepatch: introduce shadow variable API To: Miroslav Benes Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Jessica Yu , Jiri Kosina , Petr Mladek References: <1502740963-31310-1-git-send-email-joe.lawrence@redhat.com> <1502740963-31310-2-git-send-email-joe.lawrence@redhat.com> From: Joe Lawrence Organization: Red Hat Message-ID: <2fc0160b-d16a-97d3-3ea1-4a787b8afd48@redhat.com> Date: Wed, 16 Aug 2017 09:40:44 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 16 Aug 2017 13:40:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1216 Lines: 41 On 08/16/2017 08:43 AM, Miroslav Benes wrote: > >> [ ... snip ... ] > > There is a comment above about locking and we do not take the spinlock > here. That could surprise someone. So I'd keep only klp_shadow_add() > comment, because there it is strictly needed. It depends on the context in > all other cases. Good catch, I think this changed in this last version when I moved some of the work outside the lock. > Could you also add a comment above klp_shadow_lock definition about what > it aims to protect? > How about "klp_shadow_lock provides exclusive access to the klp_shadow_hash and the shadow variables it references." or were thinking of something more detailed? >> + /* Look for again under the lock */ >> + spin_lock_irqsave(&klp_shadow_lock, flags); >> + shadow_data = klp_shadow_get(obj, id); >> + if (unlikely(shadow_data)) { > > shadow_data is not needed anywhere, so you could do the same as for the > first speculative search and remove shadow_data variable all together. Ok. >> [ ... snip ... ] > > Otherwise it looks good. You can add my > > Acked-by: Miroslav Benes > > with those nits fixed. Thank you for all the suggestions and reviews! -- Joe